回到技术博客

Git使用Token连接

一、应用

多个终端使用,而且没必要配置SSH连接的情况,可以使用GitHub Token来连接使用。还有就是使用GitHub Actions时候用Token情况较SSH方便。

不同的托管平台使用语法会有差异,在此记录下GitHub、Coding、Gitee的使用

二、GitHub

GitHub生成一个Token:***

使用SSH情况:git clone [https://github.com/wztlink1013/blog3.0.git](https://github.com/wztlink1013/blog3.0.git)

使用Token情况:[https://x-access-token:**************@github.com/wztlink1013/blog3.0.git](https://x-access-token:**************@github.com/wztlink1013/blog3.0.git)

三、Coding

在个人设置中设置一个访问令牌

  • 令牌用户名:####
  • 令牌Token:*

使用SSH情况:[https://e.coding.net/wztlink1013/project/repo.git](https://e.coding.net/wztlink1013/project/repo.git)

使用令牌情况:[https://####:***********@e.coding.net/wztlink1013/project/repo.git](https://####:***********@e.coding.net/wztlink1013/project/repo.git)

四、Gitee

头像设置中申请私人令牌:**

使用SSH情况:[https://gitee.com/user/repo.git](https://gitee.com/user/repo.git)

使用Token情况:[https://oauth2:**********@gitee.com/user/repo.git](https://oauth2:**********@gitee.com/user/repo.git)

五、GitHub Actions中的使用

Github_Pages:  github.com/wztlink1013/wztlink1013.github.io
Github_Token:  ${{  secrets.token_GithubAPI  }}

git  push  --force  --quiet  "https://${Github_Token}@${Github_Pages}"
Coding_Pages:  e.coding.net/wztlink1013/wztlink1013.git
Coding_Token:  ${{  secrets.token_CodingAPI  }}
Coding_Username:  ${{  secrets.Username_Coding  }}

git  push  --force  --quiet  "https://${Coding_Username}:${Coding_Token}@${Coding_Pages}"
— 写于生活,留给未来 —

最后更新于 2024-11-17

树下留言

LET’S TALK

文字是一次相遇。很高兴听到你的声音。

评论加载中…