Gogs in docker on synology: wrong user rights


#1

Hi,

I am running the latest gogs version (Gogs Version: 0.11.29.0727) on my Synology NAS 918+ as a docker container. Set up worked fine. I have a mariadb database (also dockerized) running on the same machine and they connected.
The docker image is gogs/gogs:latest. I have linked a local folder to /data, which is in rw mode.

Gogs is set up, connected to my database and I am logged in in my browser. I can create a repository and I can git remote add it in the terminal.
I can also git add and git commit my files, however, git push -u origin master will not work.
This error pops up:

Counting objects: 1288, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (1194/1194), done.
remote: fatal: Unable to create temporary file ‘/data/git/gogs-repositories/me/.dotfiles.git/./objects/incoming-> NlcdkC/pack/tmp_pack_XXXXXX’: Permission denied
error: RPC failed; HTTP 500 curl 22 The requested URL returned error: 500 Internal Server Error
Writing objects: 100% (1288/1288), 31.87 MiB | 13.60 MiB/s, done.
Total 1288 (delta 271), reused 0 (delta 0)
error: remote unpack failed: index-pack abnormal exit
Everything up-to-date

The above error happens when I used git remote add origin http://myip:port/me/.dotfiles.git; ssh will not work either. When I git remote add origin ssh://git@myip:port/me/.dotfiles.git, I get this error:

The authenticity of host ‘[ip]:port ([ip]:port)’ can’t be established.
ECDSA key fingerprint is .
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘[ip]:port’ (ECDSA) to the list of known hosts.
Enter passphrase for key ‘/Users/me/.ssh/id_rsa’:
Counting objects: 1297, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (1202/1202), done.
remote: fatal: Unable to create temporary file ‘/data/git/gogs-repositories/me/.dotfiles.git/./objects/incoming-PBiPMB/pack/tmp_pack_XXXXXX’: Permission denied
error: remote unpack failed: index-pack abnormal exit
error: failed to push some refs to ‘ssh://git@ip:port/me/.dotfiles.git’

When I ssh into my synology and move to the gogs config directory, I get these user permissions:
drwxr-xr-x 1 1000 1000 504 Oct 10 13:10 gogs
All subdirectories are also owned by user 1000 and group 1000. I manually changed them to user docker and the appropriate group manually, but no success.

What am I doing wrong? Until now, I was running gogs dockerized on my macbook and everything worked perfectly. I did not have any problems with permissions at all. gogs itself is running as user git, which I assume is only relevant within the docker container…?

I tried setting a different user (gogs) during initial setup, but no other user besides git was able to finish the initial setup.

Any help is greatly appreciated :slight_smile:


#2

hmm… feels like very specific to Docker… sorry I don’t have enough knowledge, looking for experts to offer some ideas.


#3

Hi, I had a similar issue:

Remote: fatal: Unable to create temporary file '/data/git/gogs-repositories/(..)/./objects/incoming-HIopbA/pack/tmp_pack_XXXXXX': Permission denied        
Error: remote unpack failed: index-pack abnormal exit
Error: failed to push some refs to 'https://(..).git'

Because data was on a nfs share on qnap I had to enable nfs4. After remount to nfs4 problem disappeared.