当前位置:   article > 正文

每日一坑:Github配置ssh后,拉代码依旧需要鉴权,且鉴权失败。_github 鉴权失败

github 鉴权失败

背景:个人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的方式 

创建个人访问令牌 - GitHub Docsd

每日一坑:使用FRP内网穿透,连接Gitlab,当服务器IP更换后,新的地址web端能访问,但是clone不下来代码

 原因:因为代理地址还是以前的旧地址,换成新的就好了

# 查看全局代理地址

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

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/402054
推荐阅读
相关标签
  

闽ICP备14008679号