git pull无效

很长时间没用了,突然发现git pull没有任何反应,也不报错。打印git log,发现commitId也不对。
记录一下最后解决的办法:

  1. cd ~/.ssh
  2. vi id_rsa.pub
  3. 将公钥重新添加到仓库个人设置的SSH Public Keys中
    这时发现commitId已经正确了,但是git pull还是没有反应
  4. 执行git remote -v,复制下git url
  5. 执行git remote remove origin
  6. 执行git remote add origin %url%
  7. git pull成功

所以,应该是公钥过期了

Git配置的一些常见错误:

no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

windows:

  1. type nul> C:\Users\用户名.ssh\config
  2. 打开config,添加
Host *
KexAlgorithms +diffie-hellman-group1-sha1
  1. 重新生成公钥和私钥:ssh-keygen

mac:

  1. cd ~/.ssh/
  2. touch config
  3. vim config,粘贴:
Host *
KexAlgorithms +diffie-hellman-group1-sha1
  1. 重新生成公钥和私钥:ssh-keygen
git branch --set-upstream-to=origin/<branch> release

添加本地分支与远程分支的关联:

git branch --set-upstream-to=origin/<branch>  <local_branch>

origin/<branch>是本地分支对应的远程分支;<local_branch>是当前的本地分支

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容