Gitea: Git LFS Lock: credential issue when using SSH

Created on 4 Dec 2017  路  11Comments  路  Source: go-gitea/gitea

  • 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:

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

kinbug

Most helpful comment

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/*

All 11 comments

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] .

@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.

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

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

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

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

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

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.

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/*

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://[email protected]':

Other Git LFS feature have no auth issue

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, ...).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cookiengineer picture cookiengineer  路  3Comments

jakimfett picture jakimfett  路  3Comments

internalfx picture internalfx  路  3Comments

jonasfranz picture jonasfranz  路  3Comments

lunny picture lunny  路  3Comments