我的笔记本电脑上有一个本地 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
这将创建一个 bare repo ,在您的本地存储库中引用为“桌面”。
因为它是裸露的,所以你可以推它(如果需要的话也可以 pull 它)
git push desktop
作为ProGit book mentions , git 确实支持文件协议(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 - 如何将本地 Git 存储库推送到另一台计算机?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2888029/