-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Reporting as a bug but not 100% sure what the root cause is: user issue, a git-lfs assumption/spec interpretation that GitHub server isn't agreeing with, a bug in git-lfs, false assumption about user systems, … ¯_(ツ)_/¯
I'm inclined to think user issue, but I can't figure out what it is. If nothing else, there's some documentation that needs writing (I've read everything I could find in the GitHub.com documents and elsewhere online and tried a lot of different things).
Describe the bug
git lfs push <remote> <branch> fails with Authentication error 403
This issue has been reported by numerous people over the years (e.g., #2114, #2219, #1852, #2361, etc, etc), and I've read all of those I could find. Few of them have actual fixes, and the few that do don't seem to fix the issue I'm having. Sometimes the response was "GitHub server issue - go talk to GitHub support", which was surprising. Surely a GitHub dev can get a ticket filed that gets paid a lot more attention to than we do; and maybe someone familiar with the git-lfs internals can shed enough light on the specific issue to help the server devs find and fix it, especially since it's been tripping people up for at least 5 years). If nothing else, there's a documentation improvement issue (I'd be happy to write something up if I could figure out what the root cause was).
To Reproduce
- I am attempting to use a GitHub personal access token.
- I have a GitHub hosted read-write access fork ("haikusw_origin") of a GitHub repo to which I don't have write access ("origin").
- This repo is using lfs.
- I have a branch ("async") checked out and tracking a branch on the read-only repo ("origin").
- I wish to push this branch ("async") to the fork I have read-write access to ("haikusw_origin").
- I execute the command
git lfs push haikusw_origin async - …and receive the following error:
error: Authentication error: Authentication required: You must have push access to verify locks
Expected behavior
The branch "async" should be created in the repo "haikusw_origin"
System environment
The version of your operating system, plus any relevant information about platform or configuration (e.g., container or CI usage, Cygwin, WSL, or non-Basic authentication). If relevant, include the output of git config -l as a code block.
-
macOS X 12.3.1 on an M1 MBP
-
zsh (default for macOS X 12.x)
-
git version 2.35.2
-
git-lfs version 3.1.2 (GitHub; Darwin arm 64; go 1.17.6)
-
ssh-agent is running (
ssh-agentdumps SSH_AUTH_SOCK and SSH_AGENT_PID values,set | grep SSHshows them set). -
echo "host=github.com\nprotocol=https" | git credential fill
returns the expected output:
protocol=https
host=github.com
username=haikusw
password={correct personal token}
However, when I do GIT_TRACE=1 GIT_CURL_VERBOSE=1 git lfs push --dry-run haikusw_origin async immediately before the POST that returns 403 I see the following two log entries which I then tried on the command line directly:
% /usr/bin/security 'list-keychains'
"/Users/tyler/Library/Keychains/login.keychain-db" … "/Library/Keychains/System.keychain"
% /usr/bin/security 'find-certificate' '-a' '-p' '-c' 'gist.github.com' '/Library/Keychains/System.keychain'
%
(no output)
There is no output from the second one, which doesn't seem all that surprising - I don't expect user certificates will be in the System keychain (?).
I wonder if this is a clue? I see in the git-lfs source code that there is an intentional ignoring of the login keychain "to match browsers" or something like that. Maybe this is unrelated, but it did catch my eye.
Git Config:
credential.helper=osxkeychain
mergetool.keepbackup=true
user.name=Tyler
user.email={email address}
core.excludesfile=/Users/tyler/.gitignore_global
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
difftool.Kaleidoscope.cmd=ksdiff --partial-changeset --relative-path "$MERGED" -- "$LOCAL" "$REMOTE"
mergetool.Kaleidoscope.cmd=ksdiff --merge --output "$MERGED" --base "$BASE" -- "$LOCAL" --snapshot "$REMOTE" --snapshot
mergetool.Kaleidoscope.trustexitcode=true
commit.template=/Users/tyler/.stCommitMsg
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.haikusw_origin.url=https://[email protected]/haikusw/isowords.git
remote.haikusw_origin.gtserviceaccountidentifier=58ebcb006ed046c6e32cbbaad31fb77d0139ba9080ff2071fb3886dd99355400
remote.haikusw_origin.fetch=+refs/heads/*:refs/remotes/haikusw_origin/*
branch.haikusw_main.remote=haikusw_origin
branch.haikusw_main.merge=refs/heads/main
[email protected]:pointfreeco/isowords.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.main.remote=origin
branch.main.merge=refs/heads/main
branch.async.remote=origin
branch.async.merge=refs/heads/async
user.name=haikuty
user.email={email address}
lfs.repositoryformatversion=0
Output of git lfs env
Ok - I'm wondering why this output says "(auth=none)" at the end of the "haikusw_origin" endpoint?
That seems incorrect and possibly an indication of the root problem? (he says hopefully…).
% git lfs env
git-lfs/3.1.2 (GitHub; darwin arm64; go 1.17.6)
git version 2.35.2
Endpoint=https://github.com/pointfreeco/isowords.git/info/lfs (auth=none)
[email protected]:pointfreeco/isowords.git
Endpoint (haikusw_origin)=https://[email protected]/haikusw/isowords.git/info/lfs (auth=none)
LocalWorkingDir=/Users/Shared/OpenSource/isowords
LocalGitDir=/Users/Shared/OpenSource/isowords/.git
LocalGitStorageDir=/Users/Shared/OpenSource/isowords/.git
LocalMediaDir=/Users/Shared/OpenSource/isowords/.git/lfs/objects
LocalReferenceDirs=
TempDir=/Users/Shared/OpenSource/isowords/.git/lfs/tmp
ConcurrentTransfers=8
TusTransfers=false
BasicTransfersOnly=false
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=/Users/Shared/OpenSource/isowords/.git/lfs
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic,lfs-standalone-file,ssh
UploadTransfers=basic,lfs-standalone-file,ssh
GIT_EXEC_PATH=/opt/homebrew/Cellar/git/2.35.2/libexec/git-core
git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"
Additional context
Any other relevant context about the problem here.
A different repo forked from the same organization doing the same operation (pushing a branch they have but my fork doesn't to my fork) succeeds as expected. It's only when using git-lfs that the error happens.
Checking git lfs env (though it doesn't have the lfs git hooks installed and I don't think it's using lfs), I see the same "(auth=none)" after the endpoint name. Maybe a red herring.
% git lfs env
git-lfs/3.1.2 (GitHub; darwin arm64; go 1.17.6)
git version 2.35.2
Endpoint=https://github.com/pointfreeco/swift-parsing.git/info/lfs (auth=none)
Endpoint (haikusw-origin)=https://[email protected]/haikusw/swift-parsing.git/info/lfs (auth=none)
LocalWorkingDir=/Users/Shared/OpenSource/PointFree-swift-parsing
LocalGitDir=/Users/Shared/OpenSource/PointFree-swift-parsing/.git
LocalGitStorageDir=/Users/Shared/OpenSource/PointFree-swift-parsing/.git
LocalMediaDir=/Users/Shared/OpenSource/PointFree-swift-parsing/.git/lfs/objects
LocalReferenceDirs=
TempDir=/Users/Shared/OpenSource/PointFree-swift-parsing/.git/lfs/tmp
ConcurrentTransfers=8
TusTransfers=false
BasicTransfersOnly=false
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=/Users/Shared/OpenSource/PointFree-swift-parsing/.git/lfs
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic,lfs-standalone-file,ssh
UploadTransfers=basic,lfs-standalone-file,ssh
GIT_EXEC_PATH=/opt/homebrew/Cellar/git/2.35.2/libexec/git-core
git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"
Happy to try more things if there's something useful to try. Thanks.