Cannot find my project files on the server gitolit

2019-05-28 02:06发布

问题:

I cannot find my project files on the server gitolite is running. Basically, I built a git server using gitolite on a CentOS 6.2, and I created a new repository,I can successfully clone, pull, commit and push files to this new project, but when I logged in this server, trying to find my project files on it, I could not find them. the repository is in /home/mygituser/repositories/myproject.git/ , but none of my pushed files can be found any in there.

Is gitolite keeping the actual project contents somewhere else or is there a way to config and seperate project contents and its repository?

This is driving me crazy, any help will be highly appreciated.

回答1:

Gitolite operates with bare repositories.
A bare repo has no working tree, meaning no files.

That is why, by the way, your repo root directory ends with .git: it is a naming convention to reference bare repos.

See "Git push only for bare repositories?" for more.

Your repos are managed by default on:

~git/repositories/myrepo1.git
~git/repositories/myrepo2.git

Generally, you don't need to look to the content of a repo while being on the server: you simply clone it on a client and look it there. (the clone won't be a bare repo by default)

You could clone it on the server, if you have a proper ~git/.ssh/id_rsa(.pub) key declared as a user in the gitolite.conf file.
It is what I do, as a test, after installing/updating gitolite on my server.
That works because of my local ssh config file:

Host gitolitesrv
Hostname localhost
User @USERNAME@
Port @PORT_SSHD@
IdentityFile @H@/.ssh/gitoliteadm

So I have a ~git/.ssh/gitolite(.pub) private and public key dedicated to gitolite admin, which I can use locally on the server to clone gitolite repo if I want.
That is because I use that same key to setup gitolite:

 GITOLITE_HTTP_HOME= gitolite setup -pk "${H}/.ssh/gitoliteadm.pub"

If you have a similar setup, you can then clone any repo on the server:

git clone gitolitesrv:gitolite-admin "${gtl}/ga"


标签: gitolite