Creating a New Remote Git Repository

When not using GitHub to host your Git repositories, you don’t have the luxury of simply cloning once you’ve created the repository. There are a few extra steps documented here:

Remote Environment

mkdir NewRepo.git
cd NewRepo.git

# Create an empty repository
git --bare init

# Set the repository as shared
git config core.sharedrepository 1

# Keep the remote repository in control
git config receive.denyNonFastforwards true

sudo chown -R youruser *
sudo chgrp -R youruser *

Local Environment

mkdir NewRepo
cd NewRepo

git init
git remote add origin ssh://[email protected]:/repositories/NewRepo.git

# Give us something to commit
touch README.md

git add .
git commit -m 'Initial commit'

# This will establish the master branch allowing others to clone the repository from now on
git push origin master
comments powered by Disqus