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 < SSH_KEY.pub
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 [email protected]_SERVER_IP:gitosis-admin.git
This repository contains configuration data for gitosis, you will modify it, commit and push, and gitosis automatically reload itself.
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 [email protected] can push commits into).
To render effetive changes, do:
git commit -a -m "Allow scorp write access to sandbox"
Now let’s try the new toy, we should initialize the sandbox repository:
git remote add origin [email protected]_SERVER_IP:sandbox.git
git add helloworld.txt
git commit -m 'first test commit'
git push origin master:refs/heads/master
Happy now? Good Coding.
~/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 [email protected]:sandbox.git'
You should remember to commit changes before to push it ;)