如何将一个普通的Git仓库转换为裸机? [英] How to convert a normal Git repository to a bare one?

查看:470
本文介绍了如何将一个普通的Git仓库转换为裸机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



主要区别似乎是:




  • 在正常的git仓库中,仓库中有一个 .git 文件夹,其中包含所有相关数据和所有其他文件在裸露的Git仓库中建立你的工作副本


  • ,没有工作副本和文件夹(让我们称它为 repo.git )包含实际的数据库数据



解决方案

简而言之:将 repo 的内容替换为 repo / .git 的内容,然后告诉存储库它现在是一个裸仓库。



为此,请执行以下命令:

  cd repo 
mv .git ../repo.git#重命名只是为了清晰
cd ..
rm -fr repo
cd repo.git
git config --bool core.bare true

请注意,这与doin不同g a git clone --bare 到一个新位置(见下文)。


How can I convert a 'normal' Git repository to a bare one?

The main difference seems to be:

  • in the normal git repository you have a .git folder inside the repository containing all relevant data and all other files build your working copy

  • in a bare Git repository, there is no working copy and the folder (let's call it repo.git) contains the actual repository data

解决方案

In short: replace the contents of repo with the contents of repo/.git, then tell the repository that it is now a bare repository.

To do this, execute the following commands:

cd repo
mv .git ../repo.git # renaming just for clarity
cd ..
rm -fr repo
cd repo.git
git config --bool core.bare true

Note that this is different from doing a git clone --bare to a new location (see below).

这篇关于如何将一个普通的Git仓库转换为裸机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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