需要GIT的裸仓库 [英] Need for a bare repo in GIT

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

问题描述

在阅读教程的同时,我不断听到我需要创建一个称为裸仓库的东西来共享仓库中的所有文件。

While reading the tutorials I keep hearing that I need to create something known as a bare repository for sharing all the files in the repo.

我还听说裸回购不包含任何worfile。

I also hear that a bare repo does not contain any of the worfiles.

如果它没有任何工作文件,那么其他用户将在其本地计算机上克隆什么?

If it does not have any workfiles then what will the other users clone on their local machines???

我目前在linux服务器上有一个目录,我需要在将要通过Eclipse IDE访问的多个用户之间共享。

I currently have a directory in my linux server which i need to share among several users which will be accessing through eclipse ide's.

任何人都可以用通俗易懂的方式解释上面强调的问题。

Can anyone explain the issues highlighted above in plain words.

推荐答案


在阅读我保留的教程时听说我需要创建一个称为裸仓库的东西来共享仓库中的所有文件。

While reading the tutorials I keep hearing that I need to create something known as a bare repository for sharing all the files in the repo.

当您 git push 到远程存储库,您可以覆盖工作目录中的文件。为避免这种情况,您可以使用裸机存储库,该存储库甚至没有工作目录

When you git push to a remote repository, you can overwrite the files in the working directory. To avoid this, you can use a bare repository, which doesn't even have a working directory.

但是,由于没有工作目录,因此您不能在 中工作回购,您只能对其进行从中。这使其成为多个用户的收集点或协作存储库的理想选择-这就是为什么 git 教程说使用 bare的原因服务器存储库。

However, because there's no working directory, you can't work in the bare repo, you can only push to it and pull from it. This makes it ideal as a "collection point" or "collaboration repo" for multiple users -- which is why the git tutorials say to use a bare repository for servers.

正常的 git 回购看起来像这样:

A normal git repo looks like this:

my-repository/
    .git/
        COMMIT_EDITMSG 
        ORIG_HEAD
        description    
        index
        objects
        FETCH_HEAD     
        branches       
        gitk.cache     
        info           
        refs
        HEAD           
        config         
        hooks          
        logs
    file1
    file2

my-repository 工作目录,包含您在 file1 file2 等。所有 git 数据都存储在 .git 文件夹中。

my-repository is the working directory, containing the files you work on file1, file2 etc. All the git data is stored in the .git folder.

裸机存储库中,您没有可用的文件夹。您所拥有的只是 .git 文件夹的内容,该文件夹存储在该存储库的顶层:

On a bare repository, you don't have a working folder. All you have is the contents of the .git folder, stored in the top-level of that repository:

my-bare-repository/
    COMMIT_EDITMSG 
    ORIG_HEAD
    description    
    index
    objects
    FETCH_HEAD     
    branches       
    gitk.cache     
    info           
    refs
    HEAD           
    config         
    hooks          
    logs

这是其他用户克隆的内容。

This is what other users clone.

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

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