github使用记录

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。








评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值