git push using ssh key doesn't work #3326

Closed
opened 2025-11-02 05:08:29 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @heavygit on GitHub (May 13, 2019).

  • Gitea version (or commit ref): 1.8.1 amd64
  • Git version: 2.21.0
  • Operating system: Linux / Clearlinux
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:
    2019/05/13 22:01:54 [I] Log Mode: File(Debug)
    2019/05/13 22:01:54 [I] XORM Log Mode: File(Debug)
    2019/05/13 22:01:54 [I] Cache Service Enabled
    2019/05/13 22:01:54 [I] Session Service Enabled
    2019/05/13 22:01:54 [I] Beginning ORM engine initialization.
    2019/05/13 22:01:54 [I] ORM engine initialization attempt #1/10...
    2019/05/13 22:01:55 [I] ORM engine initialization successful!
    2019/05/13 22:01:55 [I] Git Version: 2.21.0
    2019/05/13 22:01:55 [I] Git config user.name set to Gitea
    2019/05/13 22:01:55 [I] Git config user.email set to gitea@fake.local
    2019/05/13 22:01:55 [I] SQLite3 Supported
    2019/05/13 22:01:55 [I] Run Mode: Production
    2019/05/13 22:01:57 [I] Listen: http://0.0.0.0:3000/git
    2019/05/13 22:01:57 [I] LFS server enabled
    2019/05/13 22:03:18 [D] Session ID: 9eedf4c79329c193
    2019/05/13 22:03:18 [D] CSRF Token: nc5w1Pl_7AZxIh0SiEWWxW3Nd6w6MTU1Nzc4NDk5ODUzOTM5NzYzMA==
    2019/05/13 22:03:18 [D] Session ID: 51b2c5c937025519
    2019/05/13 22:03:18 [D] CSRF Token: PfpUkTacs2eEXdh6e390AIvYMZ86MTU1Nzc4NDk5ODYzNjQ0MjkzNg==
    2019/05/13 22:04:55 [D] Session ID: 95c6160746303dde
    2019/05/13 22:04:55 [D] CSRF Token: R72mpYeBNXFcAmxHy_0zhaerNfQ6MTU1Nzc4NTA5NTYyNzg5MjcxMQ==
    2019/05/13 22:04:55 [D] Session ID: f6b412ea8293d149
    2019/05/13 22:04:55 [D] CSRF Token: C_97jIk-Ld2Kg-d8g0xkcRFdS8w6MTU1Nzc4NTA5NTY0MTE0NzcxNw==
    2019/05/13 22:04:56 [...routers/repo/http.go:211 HTTP()] [E] invalid credentials

Description

Using gitea in combination with apache mod_proxy while using HTTPS.
"git clone" using registered ssh key for authentication works correctly.
"git push" asks for password and "http.go:211 HTTP()] [E] invalid credentials" error message is written to log file.

Screenshots

N/A

Originally created by @heavygit on GitHub (May 13, 2019). - Gitea version (or commit ref): 1.8.1 amd64 - Git version: 2.21.0 - Operating system: Linux / Clearlinux - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - [ ] Not relevant - Log gist: 2019/05/13 22:01:54 [I] Log Mode: File(Debug) 2019/05/13 22:01:54 [I] XORM Log Mode: File(Debug) 2019/05/13 22:01:54 [I] Cache Service Enabled 2019/05/13 22:01:54 [I] Session Service Enabled 2019/05/13 22:01:54 [I] Beginning ORM engine initialization. 2019/05/13 22:01:54 [I] ORM engine initialization attempt #1/10... 2019/05/13 22:01:55 [I] ORM engine initialization successful! 2019/05/13 22:01:55 [I] Git Version: 2.21.0 2019/05/13 22:01:55 [I] Git config user.name set to Gitea 2019/05/13 22:01:55 [I] Git config user.email set to gitea@fake.local 2019/05/13 22:01:55 [I] SQLite3 Supported 2019/05/13 22:01:55 [I] Run Mode: Production 2019/05/13 22:01:57 [I] Listen: http://0.0.0.0:3000/git 2019/05/13 22:01:57 [I] LFS server enabled 2019/05/13 22:03:18 [D] Session ID: 9eedf4c79329c193 2019/05/13 22:03:18 [D] CSRF Token: nc5w1Pl_7AZxIh0SiEWWxW3Nd6w6MTU1Nzc4NDk5ODUzOTM5NzYzMA== 2019/05/13 22:03:18 [D] Session ID: 51b2c5c937025519 2019/05/13 22:03:18 [D] CSRF Token: PfpUkTacs2eEXdh6e390AIvYMZ86MTU1Nzc4NDk5ODYzNjQ0MjkzNg== 2019/05/13 22:04:55 [D] Session ID: 95c6160746303dde 2019/05/13 22:04:55 [D] CSRF Token: R72mpYeBNXFcAmxHy_0zhaerNfQ6MTU1Nzc4NTA5NTYyNzg5MjcxMQ== 2019/05/13 22:04:55 [D] Session ID: f6b412ea8293d149 2019/05/13 22:04:55 [D] CSRF Token: C_97jIk-Ld2Kg-d8g0xkcRFdS8w6MTU1Nzc4NTA5NTY0MTE0NzcxNw== 2019/05/13 22:04:56 [...routers/repo/http.go:211 HTTP()] [E] invalid credentials ## Description Using gitea in combination with apache mod_proxy while using HTTPS. "git clone" using registered ssh key for authentication works correctly. "git push" asks for password and "http.go:211 HTTP()] [E] invalid credentials" error message is written to log file. ## Screenshots N/A
Author
Owner

@lunny commented on GitHub (May 14, 2019):

Did you clone and push via SSH or HTTPS ?

@lunny commented on GitHub (May 14, 2019): Did you clone and push via SSH or HTTPS ?
Author
Owner

@heavygit commented on GitHub (May 14, 2019):

clone and push were done via HTTPS

@heavygit commented on GitHub (May 14, 2019): clone and push were done via HTTPS
Author
Owner

@zeripath commented on GitHub (May 14, 2019):

Could you check git remote -v ensure your remotes are using SSH

Are you running LFS? Check where the LFS is set for your clone.

@zeripath commented on GitHub (May 14, 2019): Could you check `git remote -v` ensure your remotes are using SSH Are you running LFS? Check where the LFS is set for your clone.
Author
Owner

@heavygit commented on GitHub (May 14, 2019):

Output from git remote -v
origin https://heavy@intlab.local/git/heavy/pokus.git (fetch)
origin https://heavy@intlab.local/git/heavy/pokus.git (push)
As I said, HTTPS was used for both of operations (clone, push).

No, LFS is not used.

@heavygit commented on GitHub (May 14, 2019): Output from git remote -v origin https://heavy@intlab.local/git/heavy/pokus.git (fetch) origin https://heavy@intlab.local/git/heavy/pokus.git (push) As I said, HTTPS was used for both of operations (clone, push). No, LFS is not used.
Author
Owner

@zeripath commented on GitHub (May 14, 2019):

Ok I'm confused - your issue title says that SSH key doesn't work but you're cloning and pushing via http.

@zeripath commented on GitHub (May 14, 2019): Ok I'm confused - your issue title says that SSH key doesn't work but you're cloning and pushing via http.
Author
Owner

@heavygit commented on GitHub (May 14, 2019):

No, I was confused. Of course you can use authentication using SSH keys while HTTP is being used.
The reason why clone worked is that repository hadn't been private.
Sorry guys for wasting your time.

@heavygit commented on GitHub (May 14, 2019): No, I was confused. Of course you can use authentication using SSH keys while HTTP is being used. The reason why clone worked is that repository hadn't been private. Sorry guys for wasting your time.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3326