码迷,mamicode.com
首页 > 其他好文 > 详细

git提交项目到已有库

时间:2019-09-24 12:18:35      阅读:94      评论:0      收藏:0      [点我收藏+]

标签:one   exists   关联   config   添加   online   line   related   内容   

借鉴地址:https://blog.csdn.net/jerryhanjj/article/details/72777618

Git global setup
git config --global user.name "张衍涛"
git config --global user.email "839420539@qq.com"

 

Create a new repository
git clone http://192.168.1.202:8060/guodun-online/online.git
cd online
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

 上传项目

跟踪项目文件夹中的所有文件和文件夹

git add . 

输入本次的提交说明,准备提交暂存区中的更改的已跟踪文件,单引号内为说明内容

git commit -m ‘first_commit‘

关联远程仓库,添加后,远程库的名字就是 origin,这是 Git 默认的叫法,也可以改成别的,但是 origin 这个名字一看就知道是远程库。

git remote add origin https:xxxx.git

如果关联出现错误 fatal: remote origin already exists,则执行下列语句再进行关联

git remote rm origin

把本地库的所有内容推送到远程库上

git push -u origin master

如果在推送时出现错误 error:failed to push som refs to.......,则执行下列语句

git pull origin master

将远程仓库 Github 上的文件拉下来合并之后重新推送上去

执行最后一个语句仍然报错:

fatal: refusing to merge unrelated histories

通过以下语句修复(可能是新版git的问题):

git pull origin master --allow-unrelated-histories

 

git提交项目到已有库

标签:one   exists   关联   config   添加   online   line   related   内容   

原文地址:https://www.cnblogs.com/of-course/p/11577318.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!