把项目备份到GitHub已存在的仓库

来源:互联网 发布:创始于淘宝的女装品牌 编辑:程序博客网 时间:2024/06/10 21:14

git init
git add read.txt(需要push的文件。或这使用)
git commit -m '描述信息'
git remote add origin url  (可以从GitHub直接赋值)

如果出现

To https://github.com/SomeoneCute/learngit1.git

 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/SomeoneCute/learngit1.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.


需要先pull下来:
git pull origin 分支名(比较多的直接使用master)

再push:

git push origin 分支名

(或者切换分支后再push:git checkout 分支名)


阅读全文
0 0
原创粉丝点击