天天看点

git push提交代码到远程仓库重复输入用户名密码

git push提交代码到远程仓库重复输入用户名密码

1. 新建远程仓库后默认提交协议

git push提交代码到远程仓库重复输入用户名密码

2. 命令行输入

//增加 wincred 配置
$ git config --global credential.helper wincred
//如果需要删除 wincred 配置,执行下面语句
$ git config --global --unset credential.helper wincred      
git push提交代码到远程仓库重复输入用户名密码

3. 执行后查看

$ vim ~/.gitconfig      
git push提交代码到远程仓库重复输入用户名密码

设置成功之后,之后git push 提交时首次输入密码之后以后就不用输入密码可直接提交了

1. 创建SSH KEY

如果C盘用户目录下有没有.ssh目录,有的话看下里面有没有id_rsa和id_rsa.pub这两个文件,执行命令

$ ssh-keygen -t rsa -C "[email protected]"      

其中[email protected] 为你的注册邮箱

2. 设置SSH Key

git push提交代码到远程仓库重复输入用户名密码
git push提交代码到远程仓库重复输入用户名密码

复制id_rsa.pub内容到

git push提交代码到远程仓库重复输入用户名密码
git push提交代码到远程仓库重复输入用户名密码

3. 切换克隆模式为SSH

git push提交代码到远程仓库重复输入用户名密码

4. 添加远程仓库

//关联远程仓库
$ git remote add origin [email protected]:username/test.git
// 克隆远程仓库
git clone [email protected]:username/test.git      

3. 再次推送本地文件到远程仓库,可看到成功

$ git push -u p3c-master master      
git push提交代码到远程仓库重复输入用户名密码

参考文献:

https://blog.csdn.net/cn_1937/article/details/90714019 https://blog.csdn.net/DavidFFFFFF/article/details/88849419 https://www.cnblogs.com/7day/p/10966086.html https://www.liaoxuefeng.com/wiki/896043488029600/898732864121440