Git Administration

From Elvanör's Technical Wiki
Jump to navigation Jump to search

Setup on the server

  • On Gentoo, just emerge dev-vcs/git and follow instructions there. Basically, you create the git user, edit /etc/conf.d/git-daemon and start git-daemon (I am not sure what git-daemon actually does).
  • To control access you must add SSH keys to the git user (since the home directory is in /var/git, edit /var/git/.ssh/authorized_keys).
  • You can then create empty Git repositories like this:
cd /srv/net.elvanor/git/repository-path
sudo -u git git init --bare

Cloning the repository on the client

  • Directly clone the repository on a client computer like this:
git clone ssh://git@brithombar.elvanor.net/srv/net.elvanor/git/repository-path

Deleting a remote branch

  • Use following command:
git push -d origin redesign

Reverting local changes

  • Use following command:
git checkout .