Tag Archive for 'git'

Permanently fixing permissions on a shared git repo

When creating a shared git repository (perhaps on a central server) it’s good to use the –shared option:
git init --bare --shared

If you don’t, then you may find that repository permissions get clobbered each time a different person commits and no amount of umasks, chmods and sticky bits seem to help long term.

For your next shared repo that’s fine, but if you have an existing repository you can still fix this (assuming git is your group for write access):

ssh server
chown -Rf root:git /path/to/bare/git/repo
cd /path/to/bare/git/repo
git config core.sharedRepository group
find /path/to/bare/git/repo -type f | xargs chmod 664
find /path/to/bare/git/repo -type d | xargs chmod 775
find /path/to/bare/git/repo -type d | xargs chmod g+s

Enjoy some sanity!

Delete local and remote git branches

Just a quick one for reference..

Deleting one or more local branches is trivial:
git branch --delete branch branch2

However if you want to delete regardless of the merge state:
git branch -D branch branch2

To delete a remote branch you need to push the delete:
git push remote --delete branch

The –delete option is newish, so if your git is old you can use the original syntax:
git push remote :branch

That’s all.

Using Git with Vim

Matt just sent me an article on using Git with Vim, which looks pretty awesome.

Git.vim is a more comprehensive plugin that allows the user to perform a lot more Git operations from within the Vim environment.

Now if only the plugin for Eclipse was ready..

-c

Sourceforging ahead

At work we develop two open source Java applications, Xena and DPR, both of which we host on Sourceforge under CVS. I’ve been pushing to move away from CVS for quite some time now, but it hasn’t gained much traction. This has been mostly due to the lack of a decent Eclipse plugin and partly because of developer apathy. The other day I noticed that Sourceforge enabled support for Git, my favourite SCM system. Today I came across an article saying that they will now provide support for Bazaar and Mercurial also. Sweet.