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 [email protected]
# 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 [email protected]

# Transfer the public key
ssh-copy-id -i ~/.ssh/id_dsa.pub [email protected]

# 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://[email protected]:repos/projectname.git
git add .
git commit -m "descriptive message"
git push -u origin master