[英]How to keep all commit history in an old repo and move its content into a new one if the old repository doesn't exist online?
the situation is that I have a local copy of one repository which has all commit history in its git log. 情况是我有一个存储库的本地副本,该副本的git日志中包含所有提交历史记录。 It was the course repository that I used for last semester, and now the instructor has cleaned up that repository online - so it only exists on my computer. 这是我上学期使用的课程资料库,现在,讲师已经在线清理了该资料库-因此它仅存在于我的计算机上。
I would love to keep all the commit history and move its content to a new repo. 我希望保留所有提交历史记录并将其内容移至新的存储库。 However, when I try to push remotely Git raised the error of cannot read from remote repository. 但是,当我尝试远程推送时,Git引发了无法从远程存储库读取的错误。
In this case, what can I do to keep the git log and move all contents to a newly-created repo? 在这种情况下,我该如何保存git日志并将所有内容移至新创建的仓库中?
Many thanks in advance! 提前谢谢了!
You'll need to change the origin of your repo to the new location: https://www.ethode.com/blog/git-change-remote-origin 您需要将存储库的来源更改为新位置: https : //www.ethode.com/blog/git-change-remote-origin
With that everything including the git log will be pushed to the new location. 这样,包括git日志在内的所有内容都将被推送到新位置。
$ git remote rm origin
$ git remote add origin git@github.com:username/repositoryName.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.