Thursday, January 27, 2011

simple git tricks for the central repo brained

First of all, thank you Linus Torvalds for being brilliant. Also, curse you Linus Torvalds for being brilliant. But mostly thank you.

Git is awesome, powerful, and frankly simply better than svn. In order to keep it that way, I'm posting a couple simple tricks to help me remember how to get things done and keep myself from cursing such a brilliant and productive man. Yeah, I know I'm (slightly) miss-using git.

Creating a shared repository (one that more than one person can push to). I am very well aware that git is not designed to be a centralized repository system, and that it works better as a distributed system, but I'm just not willing to take the time to securely share my repository over the internet with my colleagues. Nor do I have the simple way to execute push and pull commands to random repositories in my head. Hence, I need a shared repository to simplify things for me. I don't think that's too much of a problem: I'm not developing a linux kernel, after all.

git --bare init --shared

easy, huh? Now what happens after cloning and attempting to push to the repository?

No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
error: failed to push some refs to 'blahblahblahblah'


It's a simple configuration problem - user error. I need to specify where and what to push:

git push origin master

No comments:

Post a Comment