Setting up a brand new private Git repository

07 December 2007

These notes describe my procedure for starting a new project and setting up a private Git repository for it. For projects managed under legacy version control systems see, "Migrating Subversion repositories to Git". For public repositories see "Setting up a brand new public Git repository".

# on the remote (private) machine:
# create a new bare repository
cd /pub/git/path_to_private_repositories
sudo -u git mkdir repo.git
cd repo.git
sudo -H -u git git --bare init

# set up system for posting commit notices to weblog
sudo -u git -H git config weblog.name "name for repo in Git log"
sudo -u git -H git config weblog.host "example.com"
sudo -u git -H git config weblog.uri "/mt/mt-xmlrpc.cgi"
sudo -u git -H git config weblog.blog 1
sudo -u git -H git config weblog.login "my_login"
sudo -u git -H git config weblog.password "my_password"
sudo -u git -H git config --bool weblog.publish true
sudo -u git cp hooks/post-receive hooks/post-receive.orig
sudo -u git cp path_to_post_receive_script hooks/post-receive
sudo chmod u+x hooks/post-receive

# set up any filters required
sudo -u git -H git config --add weblog.filters "confidential phrase"

# on the local machine:
# create a new repository and prepare the initial commit
mkdir foo
cd foo
git init
git add .
git commit -s

# actually push
git remote add origin git.example.com:/pub/git/path_to_private_repositories/repo.git
git push --all

Tags

git