git ssh https 踩坑记 —- 域账号密码更新

前几天突然通知要更新公司的域账号密码,然后git pull就一直报

fatal: Authentication failed for ‘https://git ...  

很奇怪的是,有一个项目git pull push都是好的。

上网查了下用以下命令可以看到

git remote get-url origin  

好的项目是用了ssh,不好的项目用的是https,https把旧的密码存到电脑里了,所以一直登陆不上

解决方法1–修改密码:

// 清除账户密码缓存  git config --system --unset credential.helper  // 设置账户密码永久保存  git config --global credential.helper store  // 拉代码,重新输入账号密码登陆一次,以后再也不用再输账号密码  git pull  

解决方法2–改用ssh方式认证:

// 去除https源  git remote remove origin  // 添加ssh远端源  git remote add origin [email protected]:xxx/xxx.git  

ps: 值得注意的是更换origin后,分支要和远端重新关联一下

git branch --set-upstream-to=origin/dev  

原文出处:dongcoder -> http://dongcoder.com/detail-1126876.html

本站所发布的一切资源仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如果侵犯你的利益,请发送邮箱到 [email protected],我们会很快的为您处理。
超哥软件库 » git ssh https 踩坑记 —- 域账号密码更新