Problems to setup remote git server on NAS

Hi all,


I'm trying to setup a remote git server on my Synology NAS. It took me the entire last weekend and I tried any solution found in the web without success. The remote git server runs on the NAS and I can connect via SSH, I can create an empty remote git repository. Now I tried to clone this to my local machine, but this failed. However, I already have a project with a local git repository for which I want to create a remote repository on my NAS. Here is what I already tried:


1.) create an empty remote git repository for testing purposes: git init --bare test.git

Then I tried to clone to local using: git clone ssh://gituser@[NAS name]:/repos/test/test.git


2.) Copy the local git repository to the NAS. Then I added the remote repository to Xcode 9 and tried to push to remote. I was asked for the gituser password and then I got the error message from Xcode: "does not appear to be a git repository" Error -20


3.) I also tried to do the push from the bash to see a better error description, I got this error:

fatal: '/repos/test/test.git' does not appear to be a git repository

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.


4.) Now I tried the same things with an empty git repository, I tried to push and got the same error. I tried to clone and got the same error.


I checked the git versions, but I think normally this should not really matter (yes, they are different. the NAS has 2.11.3, Xcode 9 comes with 2.13.6). I also added the ssh keys to the home folder of the gituser. The git repositories are located inside the home of the gituser (and I also tried another special folder, which also did not work.


I'm not sure how to proceed now. Can anybody help me, any idea? Or does anybody know a good tutorial for someone with limited knowledge about bash? It just can't be that hard? I think this there is only one small thing missing, but what is missing now? It seems, most tutorials are out of date - I'm using DSM 6.1.4-15217 Update 2.


Sorry, I think it does not have so much to do with Xcode or Apple, but perhaps someone can help me and others having the same issues like me?


Best regards and much thanks in advance!

Jürgen

Accepted Reply

Okay, after writing this question I finally found the solution for this and I want to share it with you in case someone may find this helpful too,


1.) Forget all you probably have found in the internet and forget the help of the DSM too! It does not really work as described.

2.) Enable SSH in section "Terminal & SNMP".

3.) Create a special git user (i.e. "gituser").

4.) Go to the DSM GUI and create a shared folder (i.e. "git"). The "gituser" and the admin should have read/write access to this shared folder.

5.) On your local machine connect via SSH to the Synology NAS from the bash: ssh admin@[NAS-NAME]

6.) Goto the created git folder using cd /volume1/git

7.) Create a new empty git repository using git init "name" (the name of the repository, for now let's assume the name is "test.git")

8.) When the repository was created open another terminal window at the local folder where you want to clone this repository.

9.) To clone this git repository enter the following command: git clone ssh://gituser@[NAS-NAME]:/volume1/git/test.git


The important differences are:

- You must create the remote git repository as admin within the shared folder.

- You must always enter the absolute path

- Using a git repository in the home directory of the gituser seems not to work.

- Using relative paths seems not to work.

- You cannot create a folder directly on /volume1 as admin via SSH (as described in the DSM help)


Maybe other ways will also work, but this worked for me after 2 days of trial and error!


Regards,

Jürgen

Replies

Okay, after writing this question I finally found the solution for this and I want to share it with you in case someone may find this helpful too,


1.) Forget all you probably have found in the internet and forget the help of the DSM too! It does not really work as described.

2.) Enable SSH in section "Terminal & SNMP".

3.) Create a special git user (i.e. "gituser").

4.) Go to the DSM GUI and create a shared folder (i.e. "git"). The "gituser" and the admin should have read/write access to this shared folder.

5.) On your local machine connect via SSH to the Synology NAS from the bash: ssh admin@[NAS-NAME]

6.) Goto the created git folder using cd /volume1/git

7.) Create a new empty git repository using git init "name" (the name of the repository, for now let's assume the name is "test.git")

8.) When the repository was created open another terminal window at the local folder where you want to clone this repository.

9.) To clone this git repository enter the following command: git clone ssh://gituser@[NAS-NAME]:/volume1/git/test.git


The important differences are:

- You must create the remote git repository as admin within the shared folder.

- You must always enter the absolute path

- Using a git repository in the home directory of the gituser seems not to work.

- Using relative paths seems not to work.

- You cannot create a folder directly on /volume1 as admin via SSH (as described in the DSM help)


Maybe other ways will also work, but this worked for me after 2 days of trial and error!


Regards,

Jürgen