Fork me on GitHub

git上传 bitbucket

git clone -b +分支 + 地址

1.git 配置
git config --global user.name “用户名”

git config --global user.email “邮箱”

 

2.建立git仓库

在你的项目文件夹下执行git命令

git init

3. 将项目文件添加到仓库中

git add .

4. 将add的文件commit到仓库

git commit -m '备注'

5. 将本地仓库关联到码云上

git remote add origin git@gitee.com:shiqingqing/test.git

6. 上传码云前要先pull 下

git pull origin  master

7.  最后一步 上传代码到码云仓库

git push -u origin master

执行完后到码云看你项目的代码

8.如果有git push -u orrgin master错误

错误提示为:
To github.com:PorterLi/myDataStructCode.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:PorterLi/myDataStructCode.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 init
你应该先git clone远程仓库

然后再按照上述提交

posted @ 2020-03-11 14:40  小白不白10  阅读(690)  评论(0编辑  收藏  举报