git 使用 access token

  1. 申请token

  2. .git/config文件中修改

修改前:

[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[remote "origin"]
url = https://github.com/<username>/proj.git
fetch = +refs/heads/*:refs/remotes/origin/*

修改后:

[user]
name = <username>
email = <email>
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[remote "origin"]
url = https://<username>:<access token>@github.com/<username>/proj.git
fetch = +refs/heads/*:refs/remotes/origin/*

不需要换提交人的话,可以把[user]去掉


使用token去clone私有仓库:

git clone https://oauth2:<token>@github.com/<username>/proj.git
posted @   Ajanuw  阅读(825)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 字符编码:从基础到乱码解决
历史上的今天:
2020-09-25 ffmpeg concat设置绝对路径
2019-09-25 js bese64转化为blob使用FormData上传
点击右上角即可分享
微信分享提示