Git is by design not a centralized version control system. If you only need to collaborate with yourself and/or want to have your changes on more than one machine you can follow this quick tutorial to do so.
This guide requires:
- Access to a ssh server (university, personal server or work server)
On the server you can create a local bare git repository using the following commoand:
mkdir bare-repository
cd bare-repository
git init --bare
This initializes a bare repository, which unlike a regular Git repository, can only be accesed by interacting using another Git repository.
You can then, if you have a git repository on the server use the following command inside the repository:
git remote add bare `path-to-bare-repository`
This command adds another remote to you git repository which points at the newly created bare repository. You can now, almost like normal, run the following command:
git push bare master
In order to push to the newly created repository.
You can now add the remote repositiy as a remote on your personal computer, by running the following inside your repository:
git remote add bare username@server-address.example.com:<path-to-bare-repository>
And then, push/pull (almost) like normal:
git push bare master
git pull bare master