===== Git ===== ==== git bare ==== Very simple system to host a personnal git repository === Server === == Send keys == ssh myuser@server.com mkdir .ssh scp ~/.ssh/id_rsa.pub myuser@server.com:.ssh/authorized_keys == Add user == sudo adduser git == Add key == mkdir /home/git/.ssh sudo cp ~/.ssh/authorized_keys /home/git/.ssh/ sudo chown -R git:git /home/git/.ssh sudo chmod 700 !$ sudo chmod 600 /home/git/.ssh/*bash == Change the git user shell == sudo nano /etc/passwd git:x:1002:1003:,,,:/home/git:/usr/bin/git-shell == Create repo == cd /home/git/repos mkdir myrepo.git cd !$ git --bare init cd .. chown -R git:git myrepo.git === Client === mkdir myrepo cd myrepo git init git remote add origin git@server.com:repos/myrepo.git git add * git commit -am "First commit" git push origin master:refs/heads/master ==== delete all tags ==== rm .git/refs/tags -rf ==== merge from other repo ==== [[http://help.github.com/send-pull-requests/]] [[http://gitref.org/remotes/]] or git checkout mybranch git remote add remotename git://github.com/user/repo_to_synchro.git git fetch remotename git merge remotename/mybranch git push origin mybranch ==== patch from specific commit ==== git checkout master git format-patch -1 --stdout 1842388bb4dcf5ecd57732ffa877b6ca1a3dec7b > profiles.patch git checkout mybranch git apply --stat profiles.patch or patch -p1 < profiles.patch ==== stage multiple deleted files ==== When deleting files without git and then trying to commit changes, git is asking me to remove files using : git rm .... But when having a lot of files, i can not rm them one by one. The magic sentence to use is : git add -u ==== ssh config ==== .ssh/config Host github.com HostName github.com User git IdentityFile ~/.ssh/id_rsa-github {{tag>cli git}}