Igor Simic
4 years ago

How to setup your own Remote git Repository

Setting up git repository on your own server can be useful especially when many developers are working same project. Also, if it is going to be used only by you, it can help you by keeping all changes tracked and also it can be backup for our files.

To setup git repository, your server will need to fulfil some requirements:
  1. installed Git
  2. enabled SSH access
Create a new folder on your server where you are going to make git repositories and call it repositories, then navigate into that directory  create a folder for your project called myProject.git go into it and make it as repo by calling this command:
git init --bare
Now you have your own repository. To connect it with our local git, we are going to use SourceTree.
Open your source tree and click to settings icon (top right corner) and click on remotes:

Add origin in Source Tree

Now add SSH path to your git repo on server by clicking on Add button and insert something like this:
ssh://[email protected]/home/repositories/myProject.git
Now it will show ip on SourceTree under remotes, so you can click on it and push your files to remote repo.