如何将本地Git存储库推送到另一台计算机? [英] How to push a local Git repository to another computer?

查看:98
本文介绍了如何将本地Git存储库推送到另一台计算机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的笔记本电脑上有一个本地Git存储库安装程序。我想推到我的桌面。



我该怎么做? 如果您有权限访问到一个共享目录,你可以(见 git clone git remote ):

  git clone --bare / path / to / your / laptop / repo /shared/path/to/desktop/repo.git 
git remote add desktop /shared/path/to/desktop/repo.git

这将创建一个裸回购,在本地回购协议中引用为桌面。

由于它是裸露的,您可以推送到它(以及从它拉)

  git push desktop 

正如


最基本的是 Local 协议,其中远程存储库位于磁盘上的另一个目录中。

如果您的团队中的每个人都可以访问共享文件系统(如NFS挂载),或者不太可能大家都登录到同一台计算机的情况。



I have a local Git repository setup on my laptop. I would like to push it to my desktop.

How can I do that?

解决方案

If you have access to a shared directory, you can (see git clone and git remote):

git clone --bare /path/to/your/laptop/repo /shared/path/to/desktop/repo.git
git remote add desktop  /shared/path/to/desktop/repo.git

That will create a bare repo, referenced in your local repo as "desktop".
Since it is bare, you can push to it (as well as pull from it if needed)

git push desktop

As the ProGit book mentions, git does support the file protocol:

The most basic is the Local protocol, in which the remote repository is in another directory on disk.
This is often used if everyone on your team has access to a shared filesystem such as an NFS mount, or in the less likely case that everyone logs in to the same computer.

这篇关于如何将本地Git存储库推送到另一台计算机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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