Git LFS Lock: credential issue when using SSH #1319

Closed
opened 2025-11-02 03:56:31 -06:00 by GiteaMirror · 11 comments
Owner

Originally created by @flozz on GitHub (Dec 4, 2017).

Description

Hello,

I am testing the new git LFS lock feature and I have some issues.

When I try it on my own machine and server, I have the following error:

$ git push
Username for 'http://localhost:3000': test
Password for 'http://test@localhost:3000': 
WARNING: Authentication error: Authentication required: You must have push access to verify locks : User undefined doesn't have rigth to verify for lfs lock [rid: 1]
[...]

$ git lfs locks
Error while retrieving locks: You must have pull access to list locks : User undefined doesn't have rigth to list for lfs lock [rid: 1]

When I try on try.gitea.io, I have no error on push but I cannot get lock info:

$ git lfs lock foo.yy 
Lock failed: Repository or object not found: https://try.gitea.io/testzzx464c/lfs-lock-test.git/info/lfs/locks
Check that it exists and that you have proper access to it

I am probably doing it wrong, if someone can tell me where... :)

cc @sapk

Originally created by @flozz on GitHub (Dec 4, 2017). <!-- 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): master (c0a7899416af728634b2dc52a27b31255285ae7e) - Git version: 2.11.0 - Operating system: Ubuntu 17.06 / Debian 9 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes, but it is not exactly the same bug... https://try.gitea.io/testzzx464c/lfs-lock-test - [ ] No - [ ] Not relevant ## Description Hello, I am testing the new git LFS lock feature and I have some issues. When I try it on my own machine and server, I have the following error: ``` $ git push Username for 'http://localhost:3000': test Password for 'http://test@localhost:3000': WARNING: Authentication error: Authentication required: You must have push access to verify locks : User undefined doesn't have rigth to verify for lfs lock [rid: 1] [...] $ git lfs locks Error while retrieving locks: You must have pull access to list locks : User undefined doesn't have rigth to list for lfs lock [rid: 1] ``` When I try on try.gitea.io, I have no error on push but I cannot get lock info: ``` $ git lfs lock foo.yy Lock failed: Repository or object not found: https://try.gitea.io/testzzx464c/lfs-lock-test.git/info/lfs/locks Check that it exists and that you have proper access to it ``` I am probably doing it wrong, if someone can tell me where... :) cc @sapk
GiteaMirror added the type/bug label 2025-11-02 03:56:31 -06:00
Author
Owner

@lunny commented on GitHub (Dec 4, 2017):

It seems login failed since WARNING: Authentication error: Authentication required: You must have push access to verify locks : User undefined doesn't have rigth to verify for lfs lock [rid: 1] .

@lunny commented on GitHub (Dec 4, 2017): It seems login failed since `WARNING: Authentication error: Authentication required: You must have push access to verify locks : User undefined doesn't have rigth to verify for lfs lock [rid: 1] `.
Author
Owner

@sapk commented on GitHub (Dec 4, 2017):

@flozz you need to setup auth in git to keep your credentials. I don't know why git doesn't ask for them like any other git command.

@sapk commented on GitHub (Dec 4, 2017): @flozz you need to setup auth in git to keep your credentials. I don't know why git doesn't ask for them like any other git command.
Author
Owner

@sapk commented on GitHub (Dec 4, 2017):

I should also look again at git-lfs-authenticate in case of locks but if lfs blob are working locks should also.

@sapk commented on GitHub (Dec 4, 2017): I should also look again at git-lfs-authenticate in case of locks but if lfs blob are working locks should also.
Author
Owner

@sapk commented on GitHub (Dec 4, 2017):

Looking further more at it, I may need change some code in git-lfs-authenticate for it to work for locks.

For information:
https://github.com/git-lfs/git-lfs/blob/master/docs/api/authentication.md
https://github.com/go-gitea/gitea/blob/master/cmd/serv.go#L174

@sapk commented on GitHub (Dec 4, 2017): Looking further more at it, I may need change some code in git-lfs-authenticate for it to work for locks. For information: https://github.com/git-lfs/git-lfs/blob/master/docs/api/authentication.md https://github.com/go-gitea/gitea/blob/master/cmd/serv.go#L174
Author
Owner

@flozz commented on GitHub (Dec 4, 2017):

When I setup the credentials it still not working:

content of my .git/configfile:

[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	url = http://localhost:3000/test/test.git
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master
[gitg]
	mainline = refs/heads/master
[credential "http://localhost:3000"]
	username = test

when I try to get locks:

$ git lfs locks
Error while retrieving locks: You must have pull access to list locks : User undefined doesn't have rigth to list for lfs lock [rid: 1]

Logs from gitea:

[Macaron] 2017-12-04 17:46:27: Completed GET /test/test.git/info/lfs/locks 403 Forbidden in 11.010905ms
@flozz commented on GitHub (Dec 4, 2017): When I setup the credentials it still not working: content of my `.git/config`file: ```ini [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = http://localhost:3000/test/test.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master [gitg] mainline = refs/heads/master [credential "http://localhost:3000"] username = test ``` when I try to get locks: ``` $ git lfs locks Error while retrieving locks: You must have pull access to list locks : User undefined doesn't have rigth to list for lfs lock [rid: 1] ``` Logs from gitea: ``` [Macaron] 2017-12-04 17:46:27: Completed GET /test/test.git/info/lfs/locks 403 Forbidden in 11.010905ms ```
Author
Owner

@sapk commented on GitHub (Dec 4, 2017):

Only operation in https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md (download or upload) should be receive by git-lfs-authenticate https://github.com/git-lfs/git-lfs/blob/master/docs/api/server-discovery.md#ssh so I will try to look what git client try to do.
In the meantime you can test it but configuring credentials like in https://github.com/git-lfs/git-lfs/blob/master/docs/api/authentication.md

@sapk commented on GitHub (Dec 4, 2017): Only operation in https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md (download or upload) should be receive by git-lfs-authenticate https://github.com/git-lfs/git-lfs/blob/master/docs/api/server-discovery.md#ssh so I will try to look what git client try to do. In the meantime you can test it but configuring credentials like in https://github.com/git-lfs/git-lfs/blob/master/docs/api/authentication.md
Author
Owner

@flozz commented on GitHub (Dec 4, 2017):

ok, i will try this tomorrow, thank you :)

@flozz commented on GitHub (Dec 4, 2017): ok, i will try this tomorrow, thank you :)
Author
Owner

@sapk commented on GitHub (Dec 4, 2017):

If not working, please add env variable GIT_TRACE=1 and GIT_CURL_VERBOSE=1 to running command we may see what happen under the hood.

@sapk commented on GitHub (Dec 4, 2017): If not working, please add env variable GIT_TRACE=1 and GIT_CURL_VERBOSE=1 to running command we may see what happen under the hood.
Author
Owner

@flozz commented on GitHub (Dec 5, 2017):

Ok, it works if I put both login and password in the repository url:

[remote "origin"]
	url = http://test:test@localhost:3000/test/test.git
	fetch = +refs/heads/*:refs/remotes/origin/*
@flozz commented on GitHub (Dec 5, 2017): Ok, it works if I put both login and password in the repository url: ```ini [remote "origin"] url = http://test:test@localhost:3000/test/test.git fetch = +refs/heads/*:refs/remotes/origin/* ```
Author
Owner

@flozz commented on GitHub (Dec 11, 2017):

The lock feature itself work, but I still have an issue with credentials:

When I use ssh uri:

$ git lfs locks
Error while retrieving locks: You must have pull access to list locks : User undefined doesn't have rigth to list for lfs lock [rid: 5]

When I use http URI, I am prompted for my username and password (so it works):

$ git lfs locks
Username for 'http://git2.foo.bar': XXX
Password for 'http://XXX@git2.foo.bar':

Other Git LFS feature have no auth issue

@flozz commented on GitHub (Dec 11, 2017): The lock feature itself work, but I still have an issue with credentials: When I use ssh uri: ``` $ git lfs locks Error while retrieving locks: You must have pull access to list locks : User undefined doesn't have rigth to list for lfs lock [rid: 5] ``` When I use http URI, I am prompted for my username and password (so it works): ``` $ git lfs locks Username for 'http://git2.foo.bar': XXX Password for 'http://XXX@git2.foo.bar': ``` Other Git LFS feature have no auth issue
Author
Owner

@sapk commented on GitHub (Dec 11, 2017):

I confirm that the token methods via ssh that should work like other lfs is not working. I will need to test more what differ since it is the same methods request (upload, ...).

@sapk commented on GitHub (Dec 11, 2017): I confirm that the token methods via ssh that should work like other lfs is not working. I will need to test more what differ since it is the same methods request (upload, ...).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1319