GIT remote repo creation

In this example, I used Hostmonster but any host will most likely work the same.

ssh [remote]
mkdir mysitegit
cd mysitegit
git init --bare --shared
exit
You should now be logged in to your local computer, not the remote.
cd ~/public_html/mysite
git remote add hostmonster ssh://[remote]/~/mysitegit
nano .git/config
Now, edit the remote section of .git/config so it looks like this:
[remote "hostmonster"]
url = ssh://[remote]/~/mysitegit
fetch = +refs/heads/*:refs/remotes/hostmonster/*
uploadpack=$HOME/git/bin/git-upload-pack
receivepack=$HOME/git/bin/git-receive-pack
On another server where I didn't have the domain setup yet, my .git/config looked like this:
[remote "hostmonster"]
	url = ssh://[user]@[ipaddress]/~/mysitegit
	fetch = +refs/heads/*:refs/remotes/hostmonster/*
	uploadpack=$HOME/git/bin/git-upload-pack
	receivepack=$HOME/git/bin/git-receive-pack
Return to the terminal
git push hostmonster master
# after the first push, use just  git push hostmonster

Internal References

Article Type

General