Error 500 when adding existing deploy key to project #1783

Closed
opened 2025-11-02 04:13:10 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @FloMiau on GitHub (May 13, 2018).

  • Gitea version (or commit ref): 1546458 / 1.4.1
  • Git version: 2.7.4
  • Operating system: Ubuntu 16.04.4 LTS
  • 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:
==> xorm.log <==
2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `lower_name`, `name`, `full_name`, `email`, `keep_email_private`, `passwd`, `login_type`, `login_source`, `login_name`, `type`, `location`, `website`, `rands`, `salt`, `created_unix`, `updated_unix`, `last_login_unix`, `last_repo_visibility`, `max_repo_creation`, `is_active`, `is_admin`, `allow_git_hook`, `allow_import_local`, `allow_create_organization`, `prohibit_login`, `avatar`, `avatar_email`, `use_custom_avatar`, `num_followers`, `num_following`, `num_stars`, `num_repos`, `description`, `num_teams`, `num_members`, `diff_view_style` FROM `user` WHERE `id`=? LIMIT 1 []interface {}{1}
2018/05/13 13:02:34 [I] [SQL] SELECT count(*) FROM `notification` WHERE (user_id = ?) AND (status = ?) []interface {}{1, 0x1}
2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `owner_id`, `lower_name`, `name`, `description`, `website`, `default_branch`, `num_watches`, `num_stars`, `num_forks`, `num_issues`, `num_closed_issues`, `num_pulls`, `num_closed_pulls`, `num_milestones`, `num_closed_milestones`, `is_private`, `is_bare`, `is_mirror`, `is_fork`, `fork_id`, `size`, `created_unix`, `updated_unix` FROM `repository` WHERE `owner_id`=? AND `lower_name`=? LIMIT 1 []interface {}{1, "test1"}
2018/05/13 13:02:34 [I] [SQL] SELECT count(*) FROM `release` WHERE repo_id=? AND is_draft=? []interface {}{22, false}
2018/05/13 13:02:34 [I] [SQL] SELECT * FROM `user` INNER JOIN `team_user` ON `team_user`.org_id=`user`.id INNER JOIN `team` ON `team`.id=`team_user`.team_id WHERE (`team_user`.uid=?) AND (`team`.authorize=?) ORDER BY `user`.`name` ASC []interface {}{1, 4}
2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `owner_id`, `lower_name`, `name`, `description`, `website`, `default_branch`, `num_watches`, `num_stars`, `num_forks`, `num_issues`, `num_closed_issues`, `num_pulls`, `num_closed_pulls`, `num_milestones`, `num_closed_milestones`, `is_private`, `is_bare`, `is_mirror`, `is_fork`, `fork_id`, `size`, `created_unix`, `updated_unix` FROM `repository` WHERE (owner_id=? AND fork_id=?) LIMIT 1 []interface {}{2, 22}
2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `user_id`, `repo_id` FROM `watch` WHERE `user_id`=? AND `repo_id`=? LIMIT 1 []interface {}{1, 22}
2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `uid`, `repo_id` FROM `star` WHERE `uid`=? AND `repo_id`=? LIMIT 1 []interface {}{1, 22}
2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `repo_id`, `type`, `config`, `created_unix` FROM `repo_unit` WHERE (repo_id = ?) []interface {}{22}
2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `repo_id`, `type`, `config`, `created_unix` FROM `repo_unit` WHERE (repo_id = ?) []interface {}{22}
2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `key_id`, `repo_id`, `name`, `fingerprint`, `mode`, `created_unix`, `updated_unix` FROM `deploy_key` WHERE (repo_id = ?) []interface {}{22}
2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `owner_id`, `name`, `fingerprint`, `content`, `mode`, `type`, `created_unix`, `updated_unix` FROM `public_key` WHERE `fingerprint`=? AND `mode`=? AND `type`=? LIMIT 1 []interface {}{"SHA256:wJ20x1yZnKtV3T8E6Aet6v7iAtSsi1/qCFWDIXit5rA", 1, 2}
2018/05/13 13:02:34 [I] [SQL] BEGIN TRANSACTION
2018/05/13 13:02:34 [I] [SQL] INSERT INTO `public_key` (`owner_id`,`name`,`fingerprint`,`content`,`mode`,`type`,`created_unix`,`updated_unix`) VALUES (?, ?, ?, ?, ?, ?, ?, ?) []interface {}{0, "ubuntutest", "SHA256:wJ20x1yZnKtV3T8E6Aet6v7iAtSsi1/qCFWDIXit5rA", "ssh-rsa ..key..", 1, 2, 1526209354, 1526209354}
2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `key_id`, `repo_id`, `name`, `fingerprint`, `mode`, `created_unix`, `updated_unix` FROM `deploy_key` WHERE (key_id = ? AND repo_id = ?) LIMIT 1 []interface {}{9, 22}
2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `key_id`, `repo_id`, `name`, `fingerprint`, `mode`, `created_unix`, `updated_unix` FROM `deploy_key` WHERE (repo_id = ? AND name = ?) LIMIT 1 []interface {}{22, "ubuntutest"}
2018/05/13 13:02:34 [I] [SQL] ROLL BACK

Description

I tried to add a deploy key with different read/write settings to multiple repositories:

  1. add deploy key to repository 1 as read/write
  2. add deploy key to repository 1 again

Result:
website shows error 500

Screenshots

gitea3

Originally created by @FloMiau on GitHub (May 13, 2018). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1546458 / 1.4.1 - Git version: 2.7.4 - Operating system: Ubuntu 16.04.4 LTS - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) - [ ] No - [ ] Not relevant - Log gist: ``` ==> xorm.log <== 2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `lower_name`, `name`, `full_name`, `email`, `keep_email_private`, `passwd`, `login_type`, `login_source`, `login_name`, `type`, `location`, `website`, `rands`, `salt`, `created_unix`, `updated_unix`, `last_login_unix`, `last_repo_visibility`, `max_repo_creation`, `is_active`, `is_admin`, `allow_git_hook`, `allow_import_local`, `allow_create_organization`, `prohibit_login`, `avatar`, `avatar_email`, `use_custom_avatar`, `num_followers`, `num_following`, `num_stars`, `num_repos`, `description`, `num_teams`, `num_members`, `diff_view_style` FROM `user` WHERE `id`=? LIMIT 1 []interface {}{1} 2018/05/13 13:02:34 [I] [SQL] SELECT count(*) FROM `notification` WHERE (user_id = ?) AND (status = ?) []interface {}{1, 0x1} 2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `owner_id`, `lower_name`, `name`, `description`, `website`, `default_branch`, `num_watches`, `num_stars`, `num_forks`, `num_issues`, `num_closed_issues`, `num_pulls`, `num_closed_pulls`, `num_milestones`, `num_closed_milestones`, `is_private`, `is_bare`, `is_mirror`, `is_fork`, `fork_id`, `size`, `created_unix`, `updated_unix` FROM `repository` WHERE `owner_id`=? AND `lower_name`=? LIMIT 1 []interface {}{1, "test1"} 2018/05/13 13:02:34 [I] [SQL] SELECT count(*) FROM `release` WHERE repo_id=? AND is_draft=? []interface {}{22, false} 2018/05/13 13:02:34 [I] [SQL] SELECT * FROM `user` INNER JOIN `team_user` ON `team_user`.org_id=`user`.id INNER JOIN `team` ON `team`.id=`team_user`.team_id WHERE (`team_user`.uid=?) AND (`team`.authorize=?) ORDER BY `user`.`name` ASC []interface {}{1, 4} 2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `owner_id`, `lower_name`, `name`, `description`, `website`, `default_branch`, `num_watches`, `num_stars`, `num_forks`, `num_issues`, `num_closed_issues`, `num_pulls`, `num_closed_pulls`, `num_milestones`, `num_closed_milestones`, `is_private`, `is_bare`, `is_mirror`, `is_fork`, `fork_id`, `size`, `created_unix`, `updated_unix` FROM `repository` WHERE (owner_id=? AND fork_id=?) LIMIT 1 []interface {}{2, 22} 2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `user_id`, `repo_id` FROM `watch` WHERE `user_id`=? AND `repo_id`=? LIMIT 1 []interface {}{1, 22} 2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `uid`, `repo_id` FROM `star` WHERE `uid`=? AND `repo_id`=? LIMIT 1 []interface {}{1, 22} 2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `repo_id`, `type`, `config`, `created_unix` FROM `repo_unit` WHERE (repo_id = ?) []interface {}{22} 2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `repo_id`, `type`, `config`, `created_unix` FROM `repo_unit` WHERE (repo_id = ?) []interface {}{22} 2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `key_id`, `repo_id`, `name`, `fingerprint`, `mode`, `created_unix`, `updated_unix` FROM `deploy_key` WHERE (repo_id = ?) []interface {}{22} 2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `owner_id`, `name`, `fingerprint`, `content`, `mode`, `type`, `created_unix`, `updated_unix` FROM `public_key` WHERE `fingerprint`=? AND `mode`=? AND `type`=? LIMIT 1 []interface {}{"SHA256:wJ20x1yZnKtV3T8E6Aet6v7iAtSsi1/qCFWDIXit5rA", 1, 2} 2018/05/13 13:02:34 [I] [SQL] BEGIN TRANSACTION 2018/05/13 13:02:34 [I] [SQL] INSERT INTO `public_key` (`owner_id`,`name`,`fingerprint`,`content`,`mode`,`type`,`created_unix`,`updated_unix`) VALUES (?, ?, ?, ?, ?, ?, ?, ?) []interface {}{0, "ubuntutest", "SHA256:wJ20x1yZnKtV3T8E6Aet6v7iAtSsi1/qCFWDIXit5rA", "ssh-rsa ..key..", 1, 2, 1526209354, 1526209354} 2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `key_id`, `repo_id`, `name`, `fingerprint`, `mode`, `created_unix`, `updated_unix` FROM `deploy_key` WHERE (key_id = ? AND repo_id = ?) LIMIT 1 []interface {}{9, 22} 2018/05/13 13:02:34 [I] [SQL] SELECT `id`, `key_id`, `repo_id`, `name`, `fingerprint`, `mode`, `created_unix`, `updated_unix` FROM `deploy_key` WHERE (repo_id = ? AND name = ?) LIMIT 1 []interface {}{22, "ubuntutest"} 2018/05/13 13:02:34 [I] [SQL] ROLL BACK ``` ## Description I tried to add a deploy key with different read/write settings to multiple repositories: 1. add deploy key to repository 1 as read/write 2. add deploy key to repository 1 again Result: website shows error 500 ## Screenshots ![gitea3](https://user-images.githubusercontent.com/37121807/39966533-8bb75074-56ad-11e8-8039-248447a5f323.PNG)
GiteaMirror added the topic/uitype/bug labels 2025-11-02 04:13:10 -06:00
Author
Owner

@stale[bot] commented on GitHub (Jan 20, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Jan 20, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@adelowo commented on GitHub (Jan 20, 2019):

This was fixed by https://github.com/go-gitea/gitea/pull/4945

@adelowo commented on GitHub (Jan 20, 2019): This was fixed by https://github.com/go-gitea/gitea/pull/4945
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1783