Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 通过保留历史记录,将源代码从现有回购协议移动到新的回购协议_Git_Github - Fatal编程技术网

Git 通过保留历史记录,将源代码从现有回购协议移动到新的回购协议

Git 通过保留历史记录,将源代码从现有回购协议移动到新的回购协议,git,github,Git,Github,我们有现有的repo,我必须将源代码移动到新的存储库,并保留历史记录。在Github上创建一个repo,然后使用命令行 cd /path/to/your/repo git remote set-url origin <github URL> git pull origin master git push -u origin master cd/path/to/your/repo git远程设置url源 git拉源主机 git-push-u源主机 基本上,您正在更改默认的来源远程U

我们有现有的repo,我必须将源代码移动到新的存储库,并保留历史记录。

在Github上创建一个repo,然后使用命令行

cd /path/to/your/repo
git remote set-url origin <github URL>
git pull origin master
git push -u origin master
cd/path/to/your/repo
git远程设置url源
git拉源主机
git-push-u源主机

基本上,您正在更改默认的
来源
远程URL以指向Github。此问题不属于此类别,请在用户体验中提问。@ArpitKumarKulshrestha此问题是关于主要由程序员使用的软件工具,它非常适合这里根据。@ArpitKumarKulshrestha你在说什么?这是一个(写得不好的)合理的问题。可能是井的重复。。。。运行“push”命令后,我得到了-您是否在服务器上运行了git update server info?您可能键入了错误的名称。你的github repo是什么?你到底键入了什么?好吧,现在我正确键入了新的git url,但现在我遇到了另一个错误:错误:无法将一些引用推送到git@github..git'提示:更新被拒绝,因为推送的分支提示位于其远程提示:对应项的后面。签出此分支并合并远程更改…首先尝试拉取repo。更新了我的答案。是的,在中有冲突。但最终完成了,非常感谢