access of lfs ressources not possible when using deploy key (401 Auth required) #2938

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

Originally created by @krombel on GitHub (Feb 19, 2019).

  • Gitea version (or commit ref): 1.7.2 (1.7.1 was not working as well)
  • Git version: 2.11.0 - git lfs version 2.7.0
  • Operating system: linux
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant (lfs is not enabled)
  • Log gist:

serv.log:

2019/02/19 21:33:49 [T] GetRepositoryByOwnerAndName: http://127.0.0.1:3000/api/internal/repo/myorg/myrepo
2019/02/19 21:33:49 [T] GetPublicKeyByID: http://127.0.0.1:3000/api/internal/ssh/4
2019/02/19 21:33:49 [T] GetDeployKey: http://127.0.0.1:3000/api/internal/repositories/1/keys/4
2019/02/19 21:33:49 [T] UpdateDeployKeyUpdated: http://127.0.0.1:3000/api/internal/repositories/1/keys/4/update

xorm.log

2019/02/19 21:33:49 [I] [SQL] SELECT repository.* FROM `repository` INNER JOIN `user` ON `user`.id = repository.owner_id WHERE (repository.lower_name = ?) AND (`user`.lower_name = ?) LIMIT 1 []interface {}{"myrepo", "myorg"}                                                                                                                                                                       2019/02/19 21:33:49 [I] [SQL] SELECT `id`, `owner_id`, `name`, `fingerprint`, `content`, `mode`, `type`, `login_source_id`, `created_unix`, `updated_unix` FROM `public_key` WHERE `id`=? LIMIT 1 []interface {}{4}                                                                                                                                                                                         2019/02/19 21:33:49 [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 {}{4, 1}                                                                                                                                                                                               2019/02/19 21:33:49 [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 {}{4, 1}                                                                                                                                                                                               2019/02/19 21:33:49 [I] [SQL] UPDATE `deploy_key` SET `updated_unix` = ? WHERE `id`=? []interface {}{1550608429, 3}
2019/02/19 21:33:49 [I] [SQL] SELECT repository.* FROM `repository` INNER JOIN `user` ON `user`.id = repository.owner_id WHERE (repository.lower_name = ?) AND (`user`.lower_name = ?) LIMIT 1 []interface {}{"myrepo", "myorg"}                                                                                                                                                                       2019/02/19 21:33:49 [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`, `is_fsck_enabled`, `topics`, `created_unix`, `updated_unix` FROM `repository` WHERE `id`=? LIMIT 1 []interface {}{1}

http.log

[19/Feb/2019:21:33:49 +0100] "POST /myorg/myrepo.git/info/lfs/objects/batch HTTP/1.1" 401 26 "-" "git-lfs/2.7.0 (GitHub; linux amd64; go 1.11.1)"

Description

Fetching lfs ressources when checked out via deploy key (and therefore via ssh) is not working.
It is working though when I checkout via ssh with an ssh key which is assigned to my user

Originally created by @krombel on GitHub (Feb 19, 2019). - Gitea version (or commit ref): 1.7.2 (1.7.1 was not working as well) - Git version: 2.11.0 - git lfs version 2.7.0 - Operating system: linux - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant (lfs is not enabled) - Log gist: serv.log: ``` 2019/02/19 21:33:49 [T] GetRepositoryByOwnerAndName: http://127.0.0.1:3000/api/internal/repo/myorg/myrepo 2019/02/19 21:33:49 [T] GetPublicKeyByID: http://127.0.0.1:3000/api/internal/ssh/4 2019/02/19 21:33:49 [T] GetDeployKey: http://127.0.0.1:3000/api/internal/repositories/1/keys/4 2019/02/19 21:33:49 [T] UpdateDeployKeyUpdated: http://127.0.0.1:3000/api/internal/repositories/1/keys/4/update ``` xorm.log ``` 2019/02/19 21:33:49 [I] [SQL] SELECT repository.* FROM `repository` INNER JOIN `user` ON `user`.id = repository.owner_id WHERE (repository.lower_name = ?) AND (`user`.lower_name = ?) LIMIT 1 []interface {}{"myrepo", "myorg"} 2019/02/19 21:33:49 [I] [SQL] SELECT `id`, `owner_id`, `name`, `fingerprint`, `content`, `mode`, `type`, `login_source_id`, `created_unix`, `updated_unix` FROM `public_key` WHERE `id`=? LIMIT 1 []interface {}{4} 2019/02/19 21:33:49 [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 {}{4, 1} 2019/02/19 21:33:49 [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 {}{4, 1} 2019/02/19 21:33:49 [I] [SQL] UPDATE `deploy_key` SET `updated_unix` = ? WHERE `id`=? []interface {}{1550608429, 3} 2019/02/19 21:33:49 [I] [SQL] SELECT repository.* FROM `repository` INNER JOIN `user` ON `user`.id = repository.owner_id WHERE (repository.lower_name = ?) AND (`user`.lower_name = ?) LIMIT 1 []interface {}{"myrepo", "myorg"} 2019/02/19 21:33:49 [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`, `is_fsck_enabled`, `topics`, `created_unix`, `updated_unix` FROM `repository` WHERE `id`=? LIMIT 1 []interface {}{1} ``` http.log ``` [19/Feb/2019:21:33:49 +0100] "POST /myorg/myrepo.git/info/lfs/objects/batch HTTP/1.1" 401 26 "-" "git-lfs/2.7.0 (GitHub; linux amd64; go 1.11.1)" ``` ## Description Fetching lfs ressources when checked out via deploy key (and therefore via ssh) is not working. It is working though when I checkout via ssh with an ssh key which is assigned to my user
Author
Owner

@stale[bot] commented on GitHub (Apr 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 (Apr 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

@zeripath commented on GitHub (Apr 20, 2019):

I think this is fixed by #5939 and its backport #5966

Certainly it seems to work on the latest docker.

@zeripath commented on GitHub (Apr 20, 2019): I think this is fixed by #5939 and its backport #5966 Certainly it seems to work on the latest docker.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2938