git推送本地项目到远程gitee
- git全局设置
git config --global user.name "xxx"
git config --global user.email "xxx"
- 创建git仓库
1)进入项目根目录git init
2)添加到本地仓库git add .
git commit -m "xxxx"
提交信息
3)从远程获取最新版本并merge到本地
git pull origin master
4)提交本地分支到远程分支
git remote add origin https://gitee.com/tahara/git-... git服务器上创建一个仓库
git push -u origin master - 在提交过程中,切记要先pull代码,否则可能报出
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/tahara/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.
出现这个问题是因为gitee中的文件不在本地代码目录中,可以通过如下命令进行代码合并,之后在提交git pull --rebase origin master
- 若已有仓库
git remote add origin https://gitee.com/tahara/git-test.git
git push -u origin master
相关推荐
formula 2020-11-12
huhongfei 2020-11-05
乾坤一碼農 2020-10-27
liumengyanysu 2020-10-22
E哥的aws认证攻略 2020-10-15
guying 2020-10-05
好脑筋不如烂笔头 2020-09-17
baolen 2020-08-15
Equation 2020-08-09
Balmunc 2020-08-02
fenggou 2020-07-18
zhangxing 2020-07-05
loganwz 2020-07-05
tianyafengxin 2020-10-08
nebulali 2020-09-11