往码云上传代码过程

1.创建一个读我文件:touch README.md
2.创建.gitignore:touch .gitignore
3.git初始化,会成为一个空的git文件:git init
Initialized empty Git repository in C:/.git/
4.看项目中改变的文件:git status
5.将文件填进来:git add .
6.在看项目中的文件以改变:git status
7.提交到本地仓库里,-am后表示加注释:git commit -am '注释内容'
8.连接远程仓库:git remote add origin +git仓库的ssh地址
9.查看分支:git branch
10.把本地分支推送到远程上:git push -u origin master
报的错误:
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'gitee.com:gitee12399/che.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
11.将分支上的文件拉取上来:git pull
12.再一次把本地分支推送到远程上:git push -u origin master
报的错误:
To gitee.com:gitee12399/che.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'gitee.com:gitee12399/che.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
13.强制推送,将master覆盖:git push -u -f origin master
14.看当前的分支:git branch
15.看远程的分支:git branch -r
 origin/master
分支开发,主干发布
16.创建分支,v1.0是分支的名字:git cheakout -b v1.0  origin/master
17.查看分支:git branch
18.推送到远程:git push origin HEAD -u


报错:在第10部时与上面报错不同
报的错
error: src refspec develop does not match any
error: failed to push some refs to 'gitee.com:gitee12399/che.git'
解决方式:
输入如下代码:
1.git add .
2.git commit -m "write your meaaage"
原因:提交时未加备注信息
解决方法来源:https://segmentfault.com/q/1010000004615080

.gitignore文件:想要忽略的文件

*.class

#package file
*.war
*.ear

#kdiff3 ignore
*.orig

#maven ignore
target/

#eclipse ignore
.settings/
.project
.classpatch

#idea
.idea/
/idea/
*.ipr
*.iml
*.iws

#temp file
*.log
*.cache
*.diff
*.patch
*.tmp

#system ignore
.DS_Store
Thumbs.db
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值