If I need to get access to my files on my home computer from work or whatever, do I need to have a network server and check-in the files on there?
If I\'m using g
First, Git is distributed version control system. This means that when working with Git you have full repository at work, and you have also copy of full repository (called clone) at your home computer. You can work at your home computer, comitting changes, reading commit messages, viewing differences, switching branches etc. without need to have constant network access to your computer at work.
Your question then is about how to synchronize repositories at work and at home. There are many possibilities:
You can create bare repostory (i.e. without working directory), clone of repository, on some removable media like USB disk (pendrive). You would sync via this repository, pushing to it from one place, and fetching (pulling) from it in other place.
You can use one of Git hosting services like mentioned GitHub, and use it to synchronize your repositories. You should remember however that usually free plans require to make your repository public; if you want to have private repository you have to use paid plan (paid service). Check what the site you want to use is offering.
You can use git-bundle command: generate bundle on one side using "git bundle" command, then clone/fetch/pull on the other side using bundle file in place of repository URL e.g. git fetch file.bndl
. You can transfer bundle in any way, be it on USB flash drive, downloading it via HTTP (plain web server would be enough here), FTP or SCP.
You can serve your repository via SSH. For that you need git to have installed both at work and on your home computer, ssh daemon on server (side you are fetching from / pushing to) and ssh client on client. Git doesn't need to be installed globally for all users on server; you can tell git where to find appropriate git binaries via relevant option (see git documentation). In Tips and Tricks page on Git Wiki you would find "How to push/pull via ssh to host behind gateway?" tip.
Finally you can serve your repository via HTTP, using simple web server, just like you would publish web pages. You need to remember to run git update-server-info
to generate helper information. Usually it is done from post-update
hook (and post-commit
if repository is non-bare, i.e. if you create commits in it); check out sample hook (and read githooks documentation) to see how it is done.
See also my answer in How can I make my local Git repository available for git-pull? SO question.