Clone via ssh only working with full repo path

Hello,

I’m running into an odd issue while trying to set up Gitea. On the repository page in the browser, gitea generates the ssh address git@giteaservername.domain:myusername/repo.git. However, when I run git clone git@giteaservername.domain:myusername/repo.git I get the following error:

Cloning into 'repo'...
fatal: 'myusername/repo.git' does not appear to be a git repository
fatal: Could not read from remote repository.

However, the clone completes successfully when I replace myusername/repo.git with the full path, /var/lib/gitea/data/gitea-repositories/myusername/repo.git.

Why isn’t the shorter path recognized? The relevant sections of my app.ini are shown below, and I’m not seeing anything obviously wrong (e.g. ROOT in [repository] or WORK_PATH or APP_DATA_PATH). If it’s relevant, these repositories were taken from a backup of a previous version of gitea, and adopted via the web admin panel.

APP_NAME = Name
RUN_USER = git
WORK_PATH = /var/lib/gitea
RUN_MODE = prod

[database]
DB_TYPE = sqlite3
HOST = 127.0.0.1:3306
NAME = gitea
USER = gitea
PASSWD = [removed for forum]
SCHEMA =
SSL_MODE = disable
PATH = /var/lib/gitea/data/gitea.db
LOG_SQL = false

[repository]
ROOT = /var/lib/gitea/data/gitea-repositories

[server]
SSH_DOMAIN = giteaservername.domain
DOMAIN = giteaservername.domain
HTTP_PORT = 3000
ROOT_URL = http://giteaservername.domain:3000/
APP_DATA_PATH = /var/lib/gitea/data
DISABLE_SSH = false
SSH_PORT = 22
LFS_START_SERVER = true
LFS_JWT_SECRET = 35r-LhIICLonOvh-fxy1zcpWEPYyelCkQf1Pm7aOjBI
OFFLINE_MODE = true

Do you have any other keys in your git user’s .ssh/authorized keys?

I would guess you are getting logging in over ssh and not running gitea but accessing the git repositories directly.

1 Like

There’s only one key listed in /home/git/.ssh/authorized_keys, starting with
command="/usr/local/bin/gitea --config=/etc/gitea/app.ini serv key-1",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty,no-user-rc,restrict ssh-rsa.

However, your question reminded me of a detail I missed. When I was setting up the server, I added that same SSH key to /root/.ssh/authorized_keys using ssh-copy-id. After installing gitea, I added the same key in my user settings in the web app.

Could having the same key in both of those users’ authorized key files cause this? I wouldn’t expect that, because when I run git clone I’m specifying the git user before the @. I’ll be able to test this later today (in ~10 hrs), but let me know if I’m missing anything else important here. Thank you for your help!

Resolved - disabled Tailscale SSH on the gitea server. Was then able to use same SSH key for server root SSH and my Gitea actions without the path issue.