一:配置SSH:
1)检查ssh公钥
$ cd ~/.ssh
2)系统应该反馈“系统找不到指定文件”,那么,我们需要生成一个新的key
$ ssh-keygen -t rsa -C "your_email@youremail.com"
3)输入一个密码(passphrase),这个密码是你连接到github所用。输入之后,会生成id_rsa(私钥) 和 id_rsa.pub(公钥) 文件
访问github网站, “Account Settings” > Click “SSH Public Keys” > Click “Add another public key” ,复制 id_rsa.pub内容。
4)测试通过SSH连接到github了
ssh -T git@github.com 点yes。
二:冲突:
1.Updates were rejected because the tip of your current branch is behind
1).使用强制push的方法:
$ git push -u origin master -f
这样会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候。
2).push前先将远程repository修改pull下来
$ git pull origin master
$ git push -u origin master
3).若不想merge远程和本地修改,可以先创建新的分支:
$ git branch [name]
然后push
$ git push -u origin [name]