Gogs SSH asks password (though I've read the doc!)

I’ve read this How-To several times, but I can’t get it right. Gogs + SSH is asking for a password. I’m obviously missing/not understanding something. Please help…

  • On my host, I created a custom SSH identity file : id_rsa_gogs
  • My user name is “axelle”
  • My Gogs server is on Http is on port 3000. I am using standalone OpenSSH server which is running on port 22.
  • On the Gogs server (, /home/git/.ssh/authorized_keys seems correct and begins with command="/home/git/gogs/gogs serv key-3 --config='/home/git/gogs/custom/conf/app.ini'",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty, then followed by my public key. I added it using the Gogs web interface.
  • On the gogs server, I have a git user. I have a /home/git, but I’m unsure of one thing, in /etc/passwd, the home dir for git is ·/var/opt/gitlab. Not sure if this is normal.
  • On my host, I created a SSH .config file (in ~axelle/.ssh/config).
Host mygogs
    User git
    IdentityFile ~axelle/.ssh/id_rsa_gogs
    IdentitiesOnly yes

I try to clone:

git clone mygogs:axelle/prog.git
Cloning into 'prog'...
[email protected]'s password:

Actually, it’s a silly SSH problem probably (?), because ssh mygogs asks for a password.

ssh mygogs
[email protected]'s password:

My gogs config file:

ROOT = /home/git/gogs-repositories

DOMAIN           =
HTTP_PORT        = 3000
ROOT_URL         =
DISABLE_SSH      = false
SSH_PORT         = 22
OFFLINE_MODE     = false

Final note:

  • This is Gogs v0.11.91.0811. It is running on a Raspberry Pi 3.

FIXED. The issue was with the git account in /etc/passwd, the home dir must be set to /home/git and not /var/opt/gitlab for SSH login to succeed.

There is perhaps another way to do it, using /var/opt/gitlab and keeping a non-loggable git account, if so, please reply for a better solution, but at least this solves the issue.

Hi there. I created a user “gog” with home dir /home/gog. My gog instance works which leads me to believe that you could set the gog home as anything so long as home in your config matches /etc/passwd (so it starts in the correct dir), the dir exists, AND the user running the service (in your case git) has permissions to write to the folder. Be careful and check the r/w/x perms on the dir and I imagine selinux might be a pain too depending on what your target folder is.