on Setting Up a Remote Git Repository

There are plenty of guides on the Internet about setting up a remote git repository, so this is my quick reference on how to install git and set up a remote repository.

On the remote server

# Login to the remote server
ssh remoteUser@remoteIp
# Install Git
sudo apt-get update
sudo apt-get install git

# Create empty repo
mkdir -p ~/repos/projectname.git
git init --bare ~/repos/projectname.git

On the local machine

# Install Git
sudo apt-get update
sudo apt-get install git

# Set basic info
git config --global user.name "myName"
git config --global user.email myName@mySite.com

# Transfer the public key
ssh-copy-id -i ~/.ssh/id_dsa.pub remoteUser@remoteIp

# Create Git repo
mkdir -p ~/Code/projectname.lan
git init ~/Code/projectname.lan

# Add remote and initial push
cd ~/Code/projectname.lan
git remote add origin ssh://remoteUser@remoteIp:repos/projectname.git
git add .
git commit -m "descriptive message"
git push -u origin master