赞
踩
背景:个人github配置好ssh后,clone代码之后,写了些新的内容准备提交到github,然后提示需要输入用户名、密码,然后鉴权失败。如下图:
一、ssh失效原因:虽然配置了ssh代码但是git clone 的时候用的是http,而不是ssh,所以ssh没有生效。
1.解决方案:设置成ssh格式的url
2.查看远程URL
git remote -v
3.设置成ssh格式的url,设置完成后 通过 git remote -v 检查下是否设置成功~,然后就可以正常pull or push代码了~
git remote set-url origin git@github.com:用户名/项目.git
二、鉴权失败原因:因为github升级后不支持使用用户名,密码的方式提交code了,改为使用个人access_token的方式
原因:因为代理地址还是以前的旧地址,换成新的就好了
# 查看全局代理地址
git config --global http.proxy
git config --global https.proxy
# 查看局部代理地址git config --global http.proxy
git config --global https.proxy
设置新的IP地址
设置新的全局代理IP地址
git config --global http.proxy http://username:password@ip:port
git config --global https.proxy https://username:password@ip:port
设置新的本地,当前仓库的代理IP地址
git config --local http.proxy http.proxy http://username:password@ip:port
git config --local https.proxy https.proxy https://username:password@ip:port
常见命令:
清除全局代理命令
git config --global --unset http.proxy
git config --global --unset https.proxy清除局部代理命令
git config --local --unset http.proxy
git config --local --unset https.proxy查看全局配置信息
git config --global --list
查看局部配置信息
git config --local --list
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。