User git can login to server by ssh, but can not pull or push repository #8062

Closed
opened 2025-11-02 07:52:40 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @garfeng on GitHub (Nov 2, 2021).

Gitea Version

1.15.6

Git Version

2.31.1

Operating System

fedora 34

How are you running Gitea?

[root@fedora home]# cat /etc/systemd/system/gitea.service
[Unit]
Description=gitea

[Service]
Type=simple
User=git
Group=git
ExecStart=/usr/local/bin/gitea web --work-path /home/git/gitea/appData --config /home/git/gitea/app.ini
WorkingDirectory=/home/git/gitea/


[Install]
WantedBy=multi-user.target

with configure:

[server]
SSH_DOMAIN       = 192.168.100.130
DOMAIN           = 192.168.100.130
HTTP_PORT        = 3000
ROOT_URL         = http://192.168.100.130:3000/
DISABLE_SSH      = false
SSH_PORT         = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /home/git/gitea/data/lfs
LFS_JWT_SECRET   = ********
OFFLINE_MODE     = false
START_SSH_SERVER = false

I create a user named git to run gitea.

Database

SQLite

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Description

I can log in the host by the user git via ssh.

# ssh git@192.168.100.130
git@192.168.100.130's password:
Last login: Mon Nov  1 21:33:59 2021

But when I try to connect to the repository, I get this error:

# git push origin master
git@192.168.100.130's password:
fatal: 'garfeng/hello_world.git' does not appear to be a git repository
fatal: 无法读取远程仓库。

请确认您有正确的访问权限并且仓库存在。

Please see, It let me to input password of git. I input the right passwd, but get the error

Screenshots

No response

Originally created by @garfeng on GitHub (Nov 2, 2021). ### Gitea Version 1.15.6 ### Git Version 2.31.1 ### Operating System fedora 34 ### How are you running Gitea? ``` ini [root@fedora home]# cat /etc/systemd/system/gitea.service [Unit] Description=gitea [Service] Type=simple User=git Group=git ExecStart=/usr/local/bin/gitea web --work-path /home/git/gitea/appData --config /home/git/gitea/app.ini WorkingDirectory=/home/git/gitea/ [Install] WantedBy=multi-user.target ``` with configure: ``` [server] SSH_DOMAIN = 192.168.100.130 DOMAIN = 192.168.100.130 HTTP_PORT = 3000 ROOT_URL = http://192.168.100.130:3000/ DISABLE_SSH = false SSH_PORT = 22 LFS_START_SERVER = true LFS_CONTENT_PATH = /home/git/gitea/data/lfs LFS_JWT_SECRET = ******** OFFLINE_MODE = false START_SSH_SERVER = false ``` I create a user named `git` to run gitea. ### Database SQLite ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Description I can log in the host by the user git via ssh. ``` ssh # ssh git@192.168.100.130 git@192.168.100.130's password: Last login: Mon Nov 1 21:33:59 2021 ``` But when I try to connect to the repository, I get this error: ``` # git push origin master git@192.168.100.130's password: fatal: 'garfeng/hello_world.git' does not appear to be a git repository fatal: 无法读取远程仓库。 请确认您有正确的访问权限并且仓库存在。 ``` Please see, It let me to input password of git. I input the right passwd, but get the error ### Screenshots _No response_
Author
Owner

@garfeng commented on GitHub (Nov 2, 2021):

I have get the answer from my friend, it was because of the path of local ssh key is not ~/.ssh/id_rsa.
Following env value works.

export GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa_example"
@garfeng commented on GitHub (Nov 2, 2021): I have get the answer from my friend, it was because of the path of local ssh key is not ~/.ssh/id_rsa. Following env value works. ``` export GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa_example" ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8062