The first thing to do is to install Git on the remote server.
Once you do that the rest of the process is split into three sections:
- Server set-up
- Local set-up (push commits)
- Server (pull commits)
ssh -pxxxx [email protected](this is you connecting to your remote server)cd ../(this gets you to the 'absolute root' of the server)cd www/..../(navigate to the directory one level above your website directory - e.g. your website directory being where you would upload yourHTMLfiles etc)
Note: if (for example) your web directory is httpdocs then move up one level from there.
The following example assumes httpdocs is your web directory...
rm -rf httpdocs(remove the web directory - you'll recreate it again in a minute)mkdir httpdocs && cd httpdocs(create new web directory folder and move inside it)git init(initiate new git repo)cd ../(jump back up a directory level)
The following three commands are the black magic for getting a remote git repo setup:
git clone --bare httpdocs httpdocs.gitmv httpdocs httpdocs.backupgit clone httpdocs.git
cd ~/Desktop/Sites/myWebsitegit initgit add *git commit -m 'Start of new project'git remote add origin ssh://[email protected]:xxxx/www/.../httpdocs.gitgit push origin master
cd ../cd www/..../httpdocs/git fetchgit diff origin/mastergit merge origin/master