简体   繁体   English

在本地仓库中,git将文件保存在哪里?

[英]In a local repo where does git save the files?

I'm using a local git repo, with the main repo folder stored in a network path 我正在使用本地git repo,主repo文件夹存储在网络路径中

I can push the changes without problems and I can see the files in my repo, but when I access the main folder I don't see any files that I've pushed 我可以毫无问题地推送更改,并且可以在我的仓库中看到文件,但是当我访问主文件夹时,看不到我推送的任何文件

The files aren't store in the main repo? 文件不存储在主存储库中吗? Just locally? 只是在本地?

EDIT: there is no .git folder in my main repo, that's why I'm questioning where the files are 编辑:我的主存储库中没有.git文件夹,这就是为什么我质疑文件在哪里

Git stores repository data in hidden .git directory at the root of the repository. Git将存储库数据存储在存储库根目录的隐藏.git目录中。 In case of a barebone repository, git repository contains only contents of .git dir without any working directory. 如果是准系统存储库,则git存储库仅包含.git dir的内容,而没有任何工作目录。

Read the documentation: Git Internals - Plumbing and Porcelain . 阅读文档: Git Internals-水暖和瓷器

I think what you call "main repo" is the git remote that you push to. 我认为您所谓的“主仓库”是您推送到的git remote。 In this case I guess this remote is configured "bare", meaning that only the git-internal files are stored. 在这种情况下,我猜想该远程服务器配置为“裸机”,这意味着仅存储git内部文件。 What you are missing is the checked out version of each file. 您缺少的是每个文件的签出版本。 This is something a typical git server does not need, as there is no human directly working on those files, or any other program (besides git) using them. 这是典型的git服务器不需要的,因为没有人直接在处理这些文件或使用它们的任何其他程序(除了git)。

To clarify, the internal files are normally stored in the .git directory. 为了澄清起见,内部文件通常存储在.git目录中。 This storage also contains all previous versions (or the differences between the versions). 此存储还包含所有以前的版本(或版本之间的差异)。 Based on this, you also see your regular files. 基于此,您还将看到常规文件。 A bare repository only has the internal files. 裸存储库仅具有内部文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM