Git
From ActiveArchives
Hi all,
this is a message from your new git-admin :-) I'm willing to help you sorting out any git-related troubles you might encounter. Don't hesitate to wake me up at 4 in the morning if you run into a git conflict!
I will also take care of the gitweb, so if you need to create a new repository you can always ask me. If you feel brave, you can also do it yourself; there is a small tutorial at the end of this email.
I have created an empty repository for each OSP font plus a meta font repository containing all the individual font repositories.
http://git.constantvzw.org/
To make a local copy of an individual font repository, do:
git clone git@git.constantvzw.org:osp.foundry.fontname.git
To make a local copy of the meta repository, you will need to install git slave. For people running arch linux, I have created an arch repository at <http://aur.archlinux.org/packages.php?ID=46864>. For debian/ubuntu users I'm willing to create a package for git slave as well but for now you'll need to install it manually. You can fetch the soft at <http://sourceforge.net/projects/gitslave/>. Send me an email if you want me to help you installing it. Once you have git slave installed, do the following:
git clone git@git.constantvzw.org:osp.foundry.all.git cd osp.foundry.all gits populate # notice the trailing "s"
Basic gitslave tutorial to come, but basically the commands are the same as for git: pull push log etc. (in fact running `gits pull` is the same as running `git pull` on the "attached" individual repositories).
Do some of you'd like to take a couple of hours to review git(s) basics? We can organize a beer/pizza party at our studio some night next week.
For the braves:
HOWTO osp git web (aka Gitosis-admin)
A program called gitosis handles read and write access to the repositories hosted on git.constantvzw.org. Its configuration is itself maintained as a git repository.
To edit the configuration; do the following:
git clone git@git.constantvzw.org:gitosis-admin.git ospgit-admin cd ospgit-admin
To add a new user:
1. Copy its ssh public key into `keydir`. This public key is usually.ssh/id_rsa.pub. You can do it with your usual file manager or with the command line:
cp ${HOME}/.ssh/id_rsa.pub ${PATH_TO_GITOSIS_ADMIN}/keydir/
2. Rename the key after the the couple user@hostname found in the key. If you open the key file in a text editor this is the last word of it. With the command-line you can print the last word of id_rsa.pub like this:
awk '{print $NF}' ${HOME}/.ssh/id_rsa.pub
For me it is alexandre@alexandreleray.com so I need to rename keydir/id_rsa.pub into alexandre@alexandreleray.com.pub (don't forget the trailing ".pub")
3. open the file named gitosis.conf at the root of the repository; you will see a [group osp] section in it:
[group osp] writable = ... members = ...
add the name of the key you just copied after it being renamed, minus the .pub extension, at he end of the line begining with "members = "
[group osp] writable = ... members = ... alexandre@alexandreleray.com
4. To make the changes effective, you need to commit the change and push them:
git add keydir/alexandre@alexandreleray.com.pub git add gitosis.conf git commit -m "Added a new user" git push
To add a new repository:
1. add a section like this:
[repo osp.foundry.newfont] gitweb = yes description = shiny new font
2. add the repository name at the end of the line begining with "writable = " in the [group osp] section:
[group osp] writable = ... osp.foundry.myfont members = ...
4. To make the changes effective, you need to commit the changes and push them:
git add gitosis.conf git commit -m "Added a new repository" git push
5. However we need to populate the declared repository. Somewhere else on your computer create a new repository:
mkdir osp.foundry.myfont cd osp.foundry.myfont git init touch README git add README git commit -m "Initial commit"
or with an existing repository:
git remote add origin git@git.constantvzw.org:osp.foundry.myfont.git git push origin master
That's all for now!
-- Alex
- How to make `git push` work for repositories created with `git init`?
Hi all,
as said earlier in the git tutorial, there are two ways of obtaining a git repository:
- Cloning it from an existing repository, for instance:
git clone git@git.constantvzw.org:osp.foundry.crickx.git git clone git://gitorious.org/qt/qt.git git clone http://git.gitorious.org/qt/qt.git git clone repo repo_2 ...
- Creating it from scratch
mkdir myrepo cd myrepo git init
In the former case (git clone), your repository have some sense of "origin" because it has been cloned from an existing repository. This is why you can push your local master branch to the master branch of the original repository by typing:
git push
In the latter case your repository has no origin yet, because you've created it from scratch. If you want to push your changes to a remote repository you could:
git push git@git.constantvzw.org:myrepo.git master
but it is more convenient to keep bookmarks of the remote repositories...
git remote add origin git@git.constantvzw.org:myrepo.git git push origin master
or
git remote add stdin git@stdin.fr:myrepo.git git push stdin master
You can add as many remotes as you want, but by convention "origin" is the name of the main remote repository (and btw "master" is the name of the main branch).
Often we work with only one branch ("master") and one remote ("origin"). If you have created the repository from scratch, inform it to that by default it should push your local branch master to the branch master of the remote "origin":
git config branch.master.remote origin git config branch.master.merge refs/heads/master
You'll be then able to simple write:
git push
Here is a summary:
mkdir myrepo cd myrepo git init git remote add origin git@git.constantvzw.org:myrepo.git git config branch.master.remote origin git config branch.master.merge refs/heads/master # ... work and commit git push
If your remote repository is empty, you will have to create a branch master prior to pushing or it will reject it:
git push origin master
should make the deal!
Hope it makes sense!
Alex
GIT FAQ
How to replace master branch in git, entirely, from another branch?
You should be able to use the "ours" merge strategy to overwrite master with seotweaks like this:
git checkout seotweaks git merge -s ours master git checkout master git merge seotweaks
The result should be your master is now essentially seotweaks.