Install the “GIT server” package on your Synology Disk Station. Goto the package center and search for the “Git Server” package. Download and install it.
Install GitExtensions on your dev box.
Install the latest msysgit on your dev box.
Install the “Git Source Control Provider” Visual Studio 2010 extension on your dev box. In Visual Studio goto Tools -> Extensions and search for “Git Source Control Provider” in the online gallery.
Now SSH to your Synology (either with putty or with a Linux terminal) and execute the following commands:
cd /volume1/ mkdir git cd git mkdir repo1.git cd repo1.git git --bare init cd .. chown -R johndoe:users repo1.git
This will create a so called “bare git” repository. A bare git repository can be used as a central repository to which you push your local repositories.
Ok; now there is a GIT repository created on your Synology. Next create a new Visual Studio solution. Right click the solution name and select “Create Git Repository”. This will add an .git folder to your solution directory and now your solution is in a local Git repository.
Next commit your new solution to the Git repository.Select all files; type your comment and hit “Commit”.
Now push your local repository to the central bare git repository you created earlier. Right click the solution name; choose Git (master) -> Push. The checklist for Git settings will show up if not all settings are valid. For now just click Ok. The Push dialog appears. Specify the remote name; for example: ssh://firstname.lastname@example.org/volume1/repo1.git
Some useful GIT commands
In Visual Studio goto GIT -> GIT bash; a Bash command prompt will start.
Show available tags:
Create a tag in the GIT bash:
git tag -a v1.0.2 -m "The new version"
Commit your changes with a message:
git commit -m "Your message / comment"
Push the tag information:
git push --tag
Delete a tag:
git tag -d name_of_the_tag
GIT Use Case
Create bare repo on diskstation
git init --bare repo.git
On a client clone (initialise) a repository from the dskstation:
git clone ssh://email@example.com/volume1/git/repo.git
[Remote “origin”] can be found in .git/config file; you could add an alias for convenience. A directory repo will be created that contains your files. Add files to your repo directory
Add them to the local stage:
git add file.txt
Commit them to the local repo:
git commit -m "Your comment"
Push them to the server repo:
git push origin master
A new branch master will be created. From now on you can use git push (without the origin master)