git配置免密pull、push远程仓库github或gitee代码

第一步:添加目标地址、用户名、密码、到系统默认文件路径(默认是 ~/.git-credentials )

cat ~/.gitconfig

cd rootgitee.com

ls -a #查看所有文件:隐藏文件、可见文件

vim .git-credentials

  1. # 如果是gitee.com就https://user:password@gitee.com;
  2. # 如果是github.com就https://user:password@github.com;
  3. 其中user是你登陆gitee.com或者github.com的用户名,如果用户名是邮箱登陆有@,请转为%40,password是你的登陆密码,例如我的

https://zhiboqingy%40sina.com:123456@gitee.com

查看 cat .git-credentials

显示 https://zhiboqingy%40sina.com:123456@gitee.com

第二步:存储默认git-credentials配置文件

git config --global credential.helper store  # “store” 模式可以接受一个 --file <path> 参数,可以自定义存放密码的文件路径(默认是 ~/.git-credentials )

cat ~/.gitconfig

显示 

[credential]

helper = store

官方链接 https://git-scm.com/book/zh/v2/Git-%E5%B7%A5%E5%85%B7-%E5%87%AD%E8%AF%81%E5%AD%98%E5%82%A8#_credential_caching

第三步:免密生效检查

git clone https://gitee.com/zhiboqingy/code.git

cd code

git branch -a

git checkout develop

git fetch

git pull

以上操作,均未添加用户名和密码

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值