获取裸仓库的工作副本 [英] Getting a working copy of a bare repository

查看:107
本文介绍了获取裸仓库的工作副本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台服务器,我有一个裸机存储库供推送。但是,我的服务器需要有master分支的工作副本。

I have a server on which I have a bare repository for pushing. However, my server needs to have a working copy of the master branch.

如何获得工作副本,并且只能从裸仓库获取?

How do I get a working copy and that only from a bare repository?

推荐答案

您可以简单地将资源库克隆到同一台计算机上的另一个目录中:

You can simply clone the repository to another directory on the same machine:

git clone /bare/repo/dir.git

当前目录将成为您的仓库的非纯粹克隆,并且您将自动收到 master 分支的结帐。然后使用像 git pull 这样的常用命令来根据需要更新它。

The current directory will become a non-bare clone of your repo, and you'll get a checkout of the master branch automatically. Then use the usual commands like git pull to update it as needed.

作为一个好处,这个操作是非常高效 - 如果你指定一个本地目录到 git clone ,git会尝试使用硬链接在这两个回购站之间共享对象。

As a side benefit, this operation is very efficient — if you specify a local directory to git clone, git will try to share objects between those two repos using hard links.

这篇关于获取裸仓库的工作副本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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