裸git vs .git/-config.bare的目的 [英] Bare git vs .git/ - purpose of config.bare

查看:229
本文介绍了裸git vs .git/-config.bare的目的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:

我已经创建了一个裸仓库

I've created a bare repo

cd ~  
git init --bare GitDrive  

想法是将其用作Google驱动器的git目录

The idea was to use this as the git dir for google drive

cd "Google Drive"  
echo "gitdir: ../GitDrive  

但是git直到我从.git/config

这让我开始思考是否要进行配置设置,以决定存储库是否裸露.
阅读 git-config 似乎已被使用避免猜测回购是否裸露.

This got me thinking about the purpose of having a configuration setting whether a repo is bare or not.
Reading git-config it appears to be used to avoid having to guess whether a repo is bare or not.

我知道您不能在裸仓库中检出,但是无论config.bare设置如何,您都不能在repo/.git/中检出.

I know you can't checkout in a bare repo but you can't checkout in a repo/.git/ either regardless of the config.bare setting.

在哪些情况下git无法确定仓库是否裸露?

包含文件config/info/hooks/index ...的目录的技术术语是什么?
repo/是裸仓库,否则是repo/.git/.

What is the technical term for the directory containing the files config/info/hooks/index...?
Being repo/ for a bare repo and repo/.git/ otherwise.

使用git init --bare创建的存储库和将.git目录从实时存储库中拉出之间的技术区别是什么?

What is the technical difference between a repo created using git init --bare and pulling the .git directory out of a live repo?

推荐答案

裸仓库根本不与任何工作目录关联.其目的是接受来自其他存储库的推送.非裸存储库具有一个工作目录,该工作目录是.git文件夹的父目录.尽管从技术上可以将非裸存储库推入,但不建议这样做,因为如果您推向非裸存储库的当前分支,由于它们可能无法正确合并,因此可能会导致工作目录和索引出现问题.

A bare repository is not associated with any working directory at all. Its purpose is to accept pushes from other repositories. A non-bare repository has a working directory, which is the parent directory of the .git folder. Although non-bare repositories can technically be pushed to, it is not advisable because if you are pushing to the current branch of the non-bare repository, it can cause issues with the working directory and index since they might not be merged correctly.

一个裸存储库可以有一个当前分支,但是当您检出分支时,除了对HEAD文件没有影响.目的是使用Git命令进行浏览.无法直接查看文件结构.

A bare repository can have a current branch, but when you check out branches there is no effect except to the HEAD file. The purpose of this is to browse using Git commands. No direct view of the file structure is available.

这篇关于裸git vs .git/-config.bare的目的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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