Status message

The page you requested does not exist. A search for git repository hosting in 5 minutes with gitosis in debian lenny resulted in this page.

Git repository hosting in 5 minutes with Gitosis in Debian Lenny

Category:

After many months experiencing with SVN, we want to try to shoot with GIT.

We will use a great tool for manage our git repositories: gitosis.

aptitude install gitosis
sudo -H -u gitosis gitosis-init
where ssh_key.pub is a file that contains a public rsa key generated with ssh-keygen (as default is saved on ~/.ssh/id_rsa.pub).
The key is used to authenticate the repositories admin, so can even be on another host with ssh access.

Now on your local machine (even different where gitosis was installed, but you need the private rsa key on it):
git clone gitosis@YOUR_SERVER_IP:gitosis-admin.git
This repository contains configuration data for gitosis, you will modify it, commit and push, and gitosis automatically reload itself.

Modify gitosis.conf:
[gitosis]
[group gitosis-admin]
writable = gitosis-admin
members = scorp@antani
[group developers]
writable = sandbox
members = scorp@antani

The group gitosis-admin is the one that can manage the gitosis configuration (we are doing it now).
The group developers i've added it's the one with all developers will use to access our repositories. You can even create many different groups for many different repositories.
Sandbox is the name of a testing git repository i am going to create (not exists yet, i've only specified that the user scorp@antani can push commits into).

To render effetive changes, do:
git commit -a -m "Allow scorp write access to sandbox"
git push

Now let's try the new toy, we should initialize the sandbox repository:
mkdir sandbox
cd sandbox
git init
git remote add origin gitosis@YOUR_SERVER_IP:sandbox.git
touch helloworld.txt
git add helloworld.txt
git commit -m 'first test commit'
git push origin master:refs/heads/master

Happy now? Good Coding.

Common errors

~/sandbox$ git push origin master:refs/heads/master
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'gitosis@192.168.1.1:sandbox.git'

You should remember to commit changes before to push it ;)

References: http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way

Comments

Ankur's picture

The latest Lenny gitosis uses gitosis user so need to do this:

git clone gitosis@YOUR_SERVER_IP:gitosis-admin.git

scorp's picture

Are you sure? This doesn't apply to me, I should write gitosis@, without it pass my username, as standard ssh do.

Itz's picture

Excelent, thanks for the post.

Nightfly's picture

"You should remember to commit changes before to push it ;)"

Definitely. :S

Setting up Git on your own server « First I was like??!'s picture

[...] —— Based on scie.nti.st and LiberLabs-Blog [...]

Add new comment

Via Twitter

  • Fing - Network scanner for Android https://t.co/ukIdHHqK 1 day 6 hours ago
  • @manuelmazzuola io stavo per provare redis, ma ho un sonno che schianto e vo a letto :P lunedì si prova 1 day 21 hours ago
  • Symfony CMF as a CMS replacement for developers #phpday http://t.co/RsUTvcR3 2 days 3 hours ago
  • @rosamammoli tutti entusiasti, è un peccato fermarsi qui solo per oggi #phpday 2 days 4 hours ago
  • The room is full on track 3 for continuous deployment security on http://t.co/MOAyi4U9 #phpday 2 days 5 hours ago

Blog written by Giovanni Toraldo and licensed under CC-BY-SA

This blog is anonymously available via:
tor and tor2web.

Powered by Drupal
ipv6 test
WORLD IPV6 LAUNCH is 6 June 2012 – The Future is Forever