上传本地项目代码到github仓库

原创
2016/04/06 10:13
阅读数 70

参考代码

git init
git add yourproject
git commit -m "first commit"
git remot add origin git@ssh地址
git push -u origin master

实例操作

执行到第5步时,报错

$ git push -u origin master
To git@github.com:kaasia/studyjava.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@github.com:kaasia/studyjava.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

解决办法

git pull origin master
git push -u orgin master

DONE! :)

展开阅读全文
打赏
1
1 收藏
分享
加载中
更多评论
打赏
0 评论
1 收藏
1
分享
返回顶部
顶部