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): </code>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 ;)
🇬🇧 🇺🇸 If you found value in my content, consider supporting me by treating me to a coffee, beer, or pizza. Your contributions help fuel more quality content creation.
🇮🇹 Se hai apprezzato i miei contenuti, considera di supportarmi offrendomi un caffè, una birra o una pizza. I tuoi contributi aiutano a creare contenuti di qualità.
- Paypal
- BTC
- ETH
🇬🇧 🇺🇸 If you have found inaccuracies or wish to improve this article, please use the comments section below (after clicking on Load Comments).
🇮🇹 Se hai trovato imprecisioni o vuoi migliorare questo articolo, utilizza la sezione commenti qui sotto (dopo aver cliccato Load Comments)
Comments