1

I'm going to work on a project with a teammate, so we decided to set up a Git server. We followed this tutorial : http://git-scm.com/book/en/Git-on-the-Server-Gitosis

We created a gitrepo/ directory locally on my computer, and did a git init inside it. Then, we created a index.html file, git add index.html and git commit -m "First commit.".

We configured the remote server with git remote add origin git@SERVER:gitrepo.git, SERVER being our server. The git user seems to be ok so far, SSH keys too.

Output of git push origin master (SERVER replaced) :

Counting objects: 5, done.
Writing objects: 100% (3/3), 255 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@SERVER:gitrepo.git
   bf6c7a0..283eb49  master -> master

Seems to be okay too, but when I do a ls /home/git/repositories/gitrepo.git/branches, there is nothing. I should have a masterdirectory, with index.html in it, right ?

Something is wrong but I can't figure out what.

ryancey
  • 1,037
  • 2
  • 11
  • 27

1 Answers1

0

As gitosis uses bare repos, the answer is "No". No branches, no files, no-thing wrong.

You can read about bare repos here: http://gitolite.com/concepts/bare.html

You can test that it indeed worked by cloning the remote repo at another location/pull from it.

mnagel
  • 6,729
  • 4
  • 31
  • 66
  • Thanks mnagel. We worked this out, and managed to specify our GIT_WORK_TREE in the post-receive hook. It works, but now we would like the files to be under `www-data` permissions. So, in the `post-receive`, we got `GIT_WORK_TREE=/data/apache/www/git sudo -u www-data /usr/bin/git checkout -f`, and `git ALL = (www-data) ALL` in the sudoers file. But we got this error when pushing : `remote: fatal: This operation must be run in a work tree`. Any idea why ? – ryancey Sep 19 '13 at 13:06
  • probably `sudo` does not carry on the environment (like `GIT_WORK_TREE=/data/apache/www/git`). try to make a script that sets `GIT_WORK_TREE` and the runs `git checkout` and execute this script via `sudo`. – mnagel Sep 19 '13 at 14:53
  • Yes we did that. But we did a `git pull` of the repo instead of `git checkout` in `hook/post-receive` : http://pastebin.com/q95mySSJ – ryancey Sep 23 '13 at 13:22