Go to the other machine (the server that will host your remote repository) and do this:
ssh my_server-machine cd /big_disk/my_git_repos mkdir project.git cd project.git git --bare initUsing a name like "project.git" is entirely up to you, but this is a convention I find useful. Having done this, the next question is how to specify this remote repository from your project on some other machine.
cd my_project git remote add origin URLThe simplest case is where the respository is not remote at all, but is on the same machine. Here you just need to specify the path to the files, as in:
cd my_project git remote add origin /big_disk/my_git_repos/project.gitThis is not as stupid as it may sound. I often have a working copy of my files on the same machine that hosts the repository (and I also reference the repository from remote machines). This also works if the machine you are on uses a network mount (NFS or something of the sort) to access the files on some server.
Note that you only do the "remote add" command once and for all. Git remembers it and you simply use "origin" and before long you forget what the URL was to begin with.
Suppose you have ssh keys set up to access the remote machine holding your files, then you use the following:
Note that there is no explicit mention of ssh.
git push origin masterIn fact, the usual thing to do whenever you are working on a project and it compiles cleanly and seems like something you are willing to share is to do:
git add . git commit git push origin masterIf you have made a lot of changes, and just want to keep your local repository up to date (a good idea), you omit the last line and do:
git add . git commitBut what is this "origin" and "master" all about? The word "master" is the name of the git branch you want to push. Many projects will only have a master branch, and this is the default if you don't do any branching. The word "origin" is the short name for the URL to the remote repository. This is set up automatically for you if you do a git clone, but if you are starting from scratch with a project that has never been under git control, you set it up via a command like:
git remote add origin URL
Tom's Computer Info / tom@mmto.org