美文网首页
将本地已有项目上传到新建git仓库

将本地已有项目上传到新建git仓库

作者: 猪儿打滚 | 来源:发表于2020-06-11 10:06 被阅读0次

方法一

1、新建一个空白文件夹
2、同步git仓库到本地:git clone git仓库地址
3、复制本地项目的文件到该文件夹
4、push项目文件到git仓库:git push -u origin mster

方法二

1、新建一个git仓库(仓库1)
2、把本地项目初始化成一个git仓库(仓库2):git init
3、添加项目所有文件到仓库2中:git add .
4、版本提交和备注:git commit -m "备注信息"
5、仓库2和仓库1进行关联:git remote add origin 仓库1地址
6、pull仓库1的内容到仓库2,两个仓库进行合并,并且忽略两个仓库之间的无关性进行强行合并:git pull origin master --allow-unrelated-histories
-这里会有个坑,可能报错fatal: couldn't find remote ref branchname,那么就使用:git pull origin branchname --allow-unrelated-histories
7、pull仓库2的内容:git push origin master

https://www.cnblogs.com/issbcs/p/13149811.html

相关文章

网友评论

      本文标题:将本地已有项目上传到新建git仓库

      本文链接:https://www.haomeiwen.com/subject/clpvtktx.html