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:
To setup git repository, your server will need to fulfil some requirements:
- installed Git
- 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:
Open your source tree and click to settings icon (top right corner) and click on remotes:
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.