项目文件存储在git仓库`.git`文件夹中的位置在哪里? [英] Where are the project files stored in a git repository `.git` folder?

查看:1355
本文介绍了项目文件存储在git仓库`.git`文件夹中的位置在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为一些项目创建了一个远程仓库,所以它是我的 push 的目的地。与git的意识形态相反,它可以作为中央存储库。



然而,当我转到 *。git

   -  / branches 
- / hooks
- applypatch-msg.sample
- commit-msg.sample
- etc
- / info
- exlude
- / objects
- 06
- 1c
- 各种十六进制数字
- pack
- / refs
- / tags
- / heads
- master
- config
- description
- HEAD

这是怎么回事,我敢肯定,如果我研究git的内部工作,我可以弄清楚,但项目文件在哪里?

更新
$ b 我以如下方式创建了回购协议:


  1. 现有的本地git仓库

  2. 添加了远程的本地
    git remote add origin git@site.co.za:project_na me.git

  3. 在服务器上创建一个同名的基础存储库
    'git init --bare project_name.git`

  4. 从本地推送到远程
    git push origin master


解决方案

当您推送裸露的回购时(请参阅所有关于裸回购 - 什么,为什么以及如何解决非裸支付< a>),那么您将不会在该回购中看到您的文件,因为根据定义,它没有工作树。



您可以添加 post-receive hook < (如图所示)在 post-receive 中钩子),以检出(并看到)你的文件:

  / path / to / bare / repo。 git / hooks / post-receive:

cd /path/to/bare/repo.git
GIT_WORK_TREE = / path / to / live / server git checkout -f






如果您只想查看文件列表(或其内容)存储在裸回购,你甚至可以做到这一点,甚至没有克隆裸露的回购。

请参阅访问

 来自Git服务器的存储库文件,前提是您可以直接访问裸露的repo服务器。 GIT_DIR = / path / to / bare.git git log --pretty = format:--name-only --diff-filter = A |排序| grep。 


I created a remote repository for a number of my projects, so it is the destination of my push's. Contrary to the ideology of git, but it serves as a central repository.

However when I go to the *.git folders on the server there is a directory structure of the form:

 - /branches
 - /hooks
   - applypatch-msg.sample
   - commit-msg.sample
   - etc
 - /info
   - exlude
 - /objects
   - 06
   - 1c
   - various hex numbers
   - pack
 - /refs
   - /tags
   - /heads
     - master
 - config
 - description
 - HEAD

What is going on here, I'm sure if I studied the inner working of git I would be able to figure it out, but where are the project files?

Update

I created the repo in the following way:

  1. Had an existing local git repository
  2. Added remote to the local git remote add origin git@site.co.za:project_name.git
  3. On the server, created a base repository of the same name 'git init --bare project_name.git`
  4. Pushed from local to remote git push origin master

解决方案

When you are pushing to a bare repo (see "all about "bare" repos -- what, why, and how to fix a non-bare push"), you won't see your file in that repo, because by definition it has no working tree.

You can add a post-receive hook (like illustrated in this post-receive hook) in order to checkout (and see) your files:

/path/to/bare/repo.git/hooks/post-receive:

cd /path/to/bare/repo.git
GIT_WORK_TREE=/path/to/live/server git checkout -f


If you just want to see at the list of files (or their content) stored in that bare repo, you can do it without even having to clone said bare repo.
See "Accessing files of a repository from the Git server", provided you have a direct access to the bare repo server.

GIT_DIR=/path/to/bare.git git log --pretty=format: --name-only --diff-filter=A | sort | grep .

这篇关于项目文件存储在git仓库`.git`文件夹中的位置在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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