A guy, a blog and the internet
Remote syncing files using git
I’ve been wanting to write a post about this for a while, and a friend of mine asked about it a couple of weeks ago, and here it is…
First you need to create a remote Git repository, either on your own server or Codaset, GitHub
You will need to create a local repository:
mkdir directory_to_sync cd directory_to_sync git init touch .gitignore git add .gitignore git commit
To create a remote Git repository do the following on your server:
mkdir repository.git cd repository.git git init --bare
Once you have created the remote repository you will need to link it to your local copy:
git remote add origin ssh://server_address/path_to_repository git push origin master git pull origin master
To make life easier I always edit the Git config file and add the following:
vi .git/config
[push]
default = current
[branch "master"]
remote = origin
merge = master
The only problem with this approach is that you need to store the files in a seperate directory, but we ca get around this “limitation” by using symlinks for example to store the .bash* files in Git:
ln -s directory_to_sync/.bashrc ./
Well I hope this helps someone out there
The post is brought to you by lekhonee v0.7
| Print article | This entry was posted by Clifford W. Hansen on January 26, 2010 at 07:41:07, and is filed under Debian, Web. Follow any responses to this post through RSS 2.0. Both comments and pings are currently closed. |
Comments are closed.