博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
本地项目导入远程git仓库
阅读量:7048 次
发布时间:2019-06-28

本文共 871 字,大约阅读时间需要 2 分钟。

在你自己项目的根目录下执行如下命令
1 //初始化git本地仓库 2 git init 3  4 //添加文件到本地git仓库 5 git add . 6  7 //提交文件到本地git仓库 8 git commit -m"初始导入" 9 10 //建立远程仓库链接11 git remote add origin xxx.git12 13 //推送到远程仓库14 git push origin master

如果在执行git push origin master过程中报错如下:

1 hint: Updates were rejected because the remote contains work that you do2 hint: not have locally. This is usually caused by another repository pushing3 hint: to the same ref. You may want to first integrate the remote changes4 hint: (e.g., 'git pull ...') before pushing again.5 hint: See the 'Note about fast-forwards' in 'git push --help' for details.

则表示远程仓库代码与本地仓库代码产生版本冲突,需要将远程仓库代码pull到本地

1 //更新远程代码到本地仓库2 git pull origin master

完成上面步骤之后,就可以将本地代码推送到远程仓库啦!

1 //推送到远程仓库2 git push origin master

至此本地项目导入远程仓库完成~

附上git删除远程文件命令

1 git rm -rf --cached target/*

删除完成之后,commit、push

转载于:https://www.cnblogs.com/thierry/p/5603554.html

你可能感兴趣的文章
16.4. jstat - Java Virtual Machine Statistics Monitoring Tool
查看>>
176.6. git-svn - Bidirectional operation between a single Subversion branch and git
查看>>
各种ESB产品比较(转)
查看>>
手把手教你如何在阿里云服务器上搭建PHP环境?
查看>>
背靠中台实现基于大数据驱动的国际化电商架构(一)
查看>>
大数据时代从比特搬运工到大数据运营者
查看>>
PHP设计模式——单例模式
查看>>
Linux内核远程DoS漏洞CVE-2017-7618 4.10.9及以前版本均受影响
查看>>
利用Fitbit,十秒入侵PC
查看>>
达沃时代田大庆:融合存储是趋势
查看>>
提高 Java 代码性能的各种技巧
查看>>
大数据和警察
查看>>
施耐德电气:打造新一代数据中心基础设施
查看>>
土地紧张使香港数据中心市场增长乏力
查看>>
域名选择的六大技巧
查看>>
【过程改进】总结大中小型项目的git流程
查看>>
“十三五”输电通道规模倍增 重点建设配电网
查看>>
新区发力“互联网+”政务服务 云平台互联互通
查看>>
简述数据中心四种数据备份方式
查看>>
《编写高质量Python代码的59个有效方法》——第17条:在参数上面迭代时,要多加小心...
查看>>