1,多ssh公钥管理
ssh-keygen -t rsa -C "$your_email"
默认是.ssh/目录下id_rsa,在生成这个文件时命名为其他文件如:id_rsa2
在.ssh目录下面新建config文件
Host github.com
HostName github.com
User git
IdentityFile /Users/***/.ssh/id_rsa2
Host github.com
HostName 47.96.***.***
User git
IdentityFile /Users/***/.ssh/id_rsa
然后清空known_hosts文件内容;
执行 ssh -T git@github.com
2,refusing to merge unrelated histories
git pull origin master --allow-unrelated-histories
3, commit your changes or stash them before you can merge.
git stash
git pull
git stash pop
see:
http://blog.csdn.net/lincyang/article/details/21519333
4, failed to push some refs to 'git@github.com:....." Updates were rejected because the remote contains work that you do not have locally.
造成这个错误是在github上修改了文件,在本地文件之前没有把github上的文件拉倒本地,意思是本地和远程的文件应该合并后才能上传本地的新文件;
1、先拉下来,会自动合并
git pull origin master
2、再上传
git push -u origin master
5,
Could not read from remote repository.Please make sure you have the correct access rights.
重新生成ssh
6 ,fatal: remote origin already exists.
$ git remote rm origin
一般来说,先在github上创建一个git,然后pull到本地,后push。