Git免密pull、push

2020-10-22  本文已影响0人  迷失的信徒
git config --global credential.helper cache
git config credential.helper 'cache --timeout=3600'

这样的设置密码会在一个小时候失效

git config --global credential.helper store
http://yourname:password@git.oschina.net/name/project.git

补充:使用客户端也可以存储密码
如果你正在使用ssh而且想体验https带来的高速,那么你可以这样做: 切换到项目目录下 :

cd projectfile/

移除远程ssh方式的仓库地址

git remote rm origin

增加https远程仓库地址

git remote add origin http://yourname:password@git.oschina.net/name/project.git

http

1、在命令行输入 git config --global credentail.helper store
2、接着在命令行 git pull 拉去代码,此时需要输入密码
3、再往后的操作 pull push 都不用在输入密码

https需要增加凭据管理器

     1、建立凭据文件  ```$ touch ~/.git-credentials```
     2、在文件中加入带凭据的url信息  https://HAliyuxin:(冒号后面输入密码)@github.com
     3、 告诉git使用该凭据  $ git config --global credential.helper store
     4、执行完上面命令会在git配置文件 ~/.gitconfig 中设置一个凭据地址 

    [credential]
      helper = store

参考:https://www.cnblogs.com/lyxzxp/p/13559269.html
https://blog.csdn.net/qq_35845964/article/details/105126353

上一篇 下一篇

猜你喜欢

热点阅读