su git cd /home/git mkdir ~/.ssh & touch ~/.ssh/authorized_keys
Add or append SSH key to the access list
cat .ssh/id_rsa.pub | ssh user@you.r.ip.address "cat >> ~/.ssh/authorized_keys"
On your VPS, initialize an empty git repository
git init --bare -my-project.git
Set up your remote origin on your local computer (Linux or Mac OS)
For existing local repo, you need to change the remote origin to your new git server on VPS git remote set-url origin git@your.domain.com:my-project.git
For a new repo, set up your remote origin git init && git remote add origin git@your.domain.com:my-project.git
Now you may add/commit/push your code to you VPS git server
Create the SSH Key Pair
ssh-keygen -C "youraccount@yourmail.com"
<following the instructions>
Add new key to the ssh-agent
ssh-add ~/.ssh/id_rsa
Set up a git user and install git on VPS
useradd git
passwd git
Install git on VPS
yum install git (CentOS)
apt-get install git (Ubuntu/Debian)
Add SSH Key to the Access List
su git
cd /home/git
mkdir ~/.ssh & touch ~/.ssh/authorized_keys
cat .ssh/id_rsa.pub | ssh user@you.r.ip.address "cat >> ~/.ssh/authorized_keys"
git init --bare -my-project.git
For existing local repo, you need to change the remote origin to your new git server on VPS
git remote set-url origin git@your.domain.com:my-project.git
For a new repo, set up your remote origin
git init && git remote add origin git@your.domain.com:my-project.git