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/ release

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

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

origin/是本地分支对应的远程分支;是当前的本地分支

你可能感兴趣的:(git pull无效)