Git 突然无法 push 的解决方法

当你明明用得好好的 git 突然无法推送,提示如下信息:

1
2
3
4
5
6
7
vagrant@homestead:~/code/jianbing$ git push
identity_sign: private key /home/vagrant/.ssh/id_rsa contents do not match public
git@e.coding.net: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

只需要重新进行一些配置即可恢复 push,代码如下

1
2
3
4
git config --global user.name "Your Name"
git config --global user.email your@example.com
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa

然后就可以和往常一样的 git push 了