Tuesday, March 22, 2011

Setting up a remote repository and doing an initial push

Followed and copied from:

http://thelucid.com/2008/12/02/git-setting-up-a-remote-repository-and-doing-an-initial-push/

There is loads of documentation and posts on Git out there so this is more of a note to self as I keep forgetting the steps to setting up a remote repository and doing an initial ‘push’.

So, firstly setup the remote repository:

ssh git@example.com
mkdir my_project.git
cd my_project.git
git init --bare
git-update-server-info # If planning to serve via HTTP exit

On local machine:

cd my_project
git init
git add *
git commit -m "My initial commit message"
git remote add origin git@example.com:my_project.git
git push origin master

Done!

Team members can now clone and track the remote repository using the following:

git clone git@example.com:my_project.git