如何将我的本地Git存储库移动到远程Git存储库 [英] How do I move my local Git repository to a remote Git repository

查看:108
本文介绍了如何将我的本地Git存储库移动到远程Git存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的本地机器上的各种Git项目。我有一台服务器,我想用作我的远程Git存储库。如何将我的本地Git存储库(项目)移动到我的服务器,同时保持历史记录不变?

谢谢!



<编辑:
感谢所有伟大的答案。我选择的答案对我有限的GIT知识是有意义的。


编辑#2:
我注意到我的原始答案选择没有复制我的标签。 git push --mirror< path> 不会复制标签。

解决方案

在服务器上创建git仓库作为裸仓库

  git init --bare repo.git 

然后,推送您本地存储库的提交信息

  git push --mirror ssh://yourserver/~/repo.git 


I have various Git projects that are on my local machine. I have a server that I would like to use as my remote Git Repository. How do I move my local Git Repositories (Projects) to my server while keeping the history intact?

Thanks!

EDIT: Thanks for all the great answers. The response I choose makes sense to my limited GIT knowledge.

EDIT #2: I noticed my original answer selection did not copy my tags. git push --mirror <path> does copy tags.

解决方案

On your server create the git repositories as bare repository

git init --bare repo.git

then, push the commits of your local repository

git push --mirror ssh://yourserver/~/repo.git

这篇关于如何将我的本地Git存储库移动到远程Git存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆