Create a local and remote git repository pair

When starting a project, I need revision control locally but also on a central repository. Nowadays I use git for revision control and my Synology NAS server to host the remote repository. Below are the steps I use to set everything up.

1. Remotely access using SSH the remote NAS server.

ssh user@

2. On the server, create an empty folder for the repository.

mkdir repo.git

3. Get into the folder.

cd repo.git

4. Initialise an empty, bare git repository.

git init --bare

5. On the local machine, get into the project folder.

cd localcode

6. Initalise a local git repository.

git init

7. Tell the local git repository about the remote repository on the NAS server.

git remote add origin ssh://user@

8. Place all local project files under version control.

git add .

9. Commit the added files to the local git repository.

git commit -a -m 'Initializing repository'

10. Push the local, master branch to the origin, remote git repository.

git push origin master

Leave a Reply

Your email address will not be published. Required fields are marked *