更新时间:2023-09-12 23:20:10
当您推送裸露的回购时(请参阅所有关于裸回购 - 什么,为什么以及如何解决非裸支付),那么您将不会在该回购中看到您的文件,因为根据定义,它没有工作树。
您可以添加 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:
git remote add origin git@site.co.za:project_name.git
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 .