Cant clone or push via SSH due to key issue after upgrading to 1.5.3 #2516

Closed
opened 2025-11-02 04:39:08 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @felixgonsug on GitHub (Nov 12, 2018).

  • Gitea version (or commit ref): 1.5.3
  • Git version: 2.19.1
  • Operating system: FreeBSD 11.2-RELEASE
  • 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:

Description

After upgrading Gitea FreeBSD port to 1.5.3, when i try to interact with any repository via ssh, this is what i get:

$ git clone ssh://git@mygitinstance.com:22/repository.git
Cloning into 'repository'...
Enter passphrase for key '/home/user/.ssh/id_rsa':
Gitea: Invalid key ID
Invalid key ID[key-7]: pq: column "login_source_id" does not exist
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I checked the .ssh/authorized_keys and the key is present and with the correct ID, I also checked the database and the key is present with the same ID in the public_key table. The column login_source_id is not present in the public_key table.

The key was added via the web interface. For some reason gitea is not creating the column login_source_id.

This is what i get in /log/gitea/serv.log

2018/11/12 00:06:15 [...io/gitea/cmd/serv.go:203 runServ()] [F] Invalid key ID[key-7]: pq: column "login_source_id" does not exist

And this from /log/gitea/xorm.log

[I] [SQL] SELECT "id", "owner_id", "name", "fingerprint", "content", "mode", "type", "login_source_id", "created_unix", "updated_unix" FROM "public_key" WHERE "id"=$1 LIMIT 1 []interface {}{7}
Originally created by @felixgonsug on GitHub (Nov 12, 2018). - Gitea version (or commit ref): 1.5.3 - Git version: 2.19.1 - Operating system: FreeBSD 11.2-RELEASE - Database (use `[x]`): - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - [ ] Not relevant - Log gist: ## Description After upgrading Gitea FreeBSD port to 1.5.3, when i try to interact with any repository via ssh, this is what i get: ``` $ git clone ssh://git@mygitinstance.com:22/repository.git Cloning into 'repository'... Enter passphrase for key '/home/user/.ssh/id_rsa': Gitea: Invalid key ID Invalid key ID[key-7]: pq: column "login_source_id" does not exist fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. ``` I checked the .ssh/authorized_keys and the key is present and with the correct ID, I also checked the database and the key is present with the same ID in the public_key table. The column login_source_id is not present in the public_key table. The key was added via the web interface. For some reason gitea is not creating the column login_source_id. This is what i get in /log/gitea/serv.log ``` 2018/11/12 00:06:15 [...io/gitea/cmd/serv.go:203 runServ()] [F] Invalid key ID[key-7]: pq: column "login_source_id" does not exist ``` And this from /log/gitea/xorm.log ``` [I] [SQL] SELECT "id", "owner_id", "name", "fingerprint", "content", "mode", "type", "login_source_id", "created_unix", "updated_unix" FROM "public_key" WHERE "id"=$1 LIMIT 1 []interface {}{7} ```
Author
Owner

@lunny commented on GitHub (Nov 12, 2018):

Your database table public_key missed a column named login_source_id

@lunny commented on GitHub (Nov 12, 2018): Your database table `public_key` missed a column named `login_source_id`
Author
Owner

@felixgonsug commented on GitHub (Nov 12, 2018):

How can i solve this? Aparentlygitea is not creating the table correctly.

@felixgonsug commented on GitHub (Nov 12, 2018): How can i solve this? Aparentlygitea is not creating the table correctly.
Author
Owner

@felixgonsug commented on GitHub (Nov 12, 2018):

I added the column manually with the properties set in https://github.com/go-gitea/gitea/blob/master/models/ssh_key.go (BIGINT, NOT NULL, DEFAULT 0) but now im getting this

$ git push
Gitea: You do not have allowed for this action
User felix does not have allowed access to repository repository.git 's code
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

But i have the correct access rights.

@felixgonsug commented on GitHub (Nov 12, 2018): I added the column manually with the properties set in https://github.com/go-gitea/gitea/blob/master/models/ssh_key.go (BIGINT, NOT NULL, DEFAULT 0) but now im getting this ``` $ git push Gitea: You do not have allowed for this action User felix does not have allowed access to repository repository.git 's code fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. ``` But i have the correct access rights.
Author
Owner

@felixgonsug commented on GitHub (Nov 13, 2018):

SOLVED!
I made the querys that appeared in the /log/gitea/xorm.log file after trying to clone, with no success, a repository. There was a column called "languaje" missing in the "user" table, i added this column and everything works again.

What i suppose that happened, was that in the new version there was a new schema for the DB and gitea didnt update it correctly. Take a look at that, maybe some issues are related.

@felixgonsug commented on GitHub (Nov 13, 2018): SOLVED! I made the querys that appeared in the /log/gitea/xorm.log file after trying to clone, with no success, a repository. There was a column called "languaje" missing in the "user" table, i added this column and everything works again. What i suppose that happened, was that in the new version there was a new schema for the DB and gitea didnt update it correctly. Take a look at that, maybe some issues are related.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2516