Cannot authenticate from scheduled git-maintenance (systemd timers)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- csharp, git, github
- Domain
- authentication, operating-systems
Research direction
Reproduce the failure with the user systemd unit at ~/.config/systemd/user/git-maintenance@.service, comparing a scheduled run with a local command and enabling the reported GCM_TRACE and GIT_TRACE options. Trace the credential request from git-maintenance through Git Credential Manager; done means scheduled maintenance can authenticate and complete without the password or prefetch errors.
Written by the indexing model from the issue text.
Description
Version
2.4.1
Operating system
Linux
OS version or distribution
Ubuntu 22.04
Git hosting provider(s)
GitHub
Other hosting provider
No response
(Azure DevOps only) What format is your remote URL?
None
Can you access the remote repository directly in the browser?
Yes, I can access the repository
Expected behavior
I'm currently using scalar to manage repositories. It triggers git-maintenance to schedule periodic management operations in the form of systemd timer.
# Installed gcm 2.4.1 beforehand.
git config --global credential.credentialStore gpg
scalar clone <some_private_repo>
With gcm I can access, clone and push the repo as needed in my local sessions like terminals and GUIs. So this should work on generated git-maintenance jobs as well.
Actual behavior
In my recently clean installation of Ubuntu I found that git-maintenance jobs are failing:
# Both periodic timer and manual run via `systemctl --user start git-maintenance@hourly.service` yields similar results
$ systemctl --user status git-maintenance@hourly.service
× git-maintenance@hourly.service - Optimize Git repositories data
Loaded: loaded (/home/ned/.config/systemd/user/git-maintenance@.service; static)
Active: failed (Result: exit-code) since Wed 2024-01-24 10:13:27 KST; 8min ago
TriggeredBy: ● git-maintenance@hourly.timer
Process: 57680 ExecStart=/usr/local/lib/git-core/git --exec-path=/usr/local/lib/git-core -c credential.interactive=false -c core.askPass=true for-eac>
Main PID: 57680 (code=exited, status=1/FAILURE)
CPU: 74ms
Jan 24 10:13:27 ned systemd[2367]: Starting Optimize Git repositories data...
Jan 24 10:13:27 ned git[57686]: Segmentation fault (core dumped)
Jan 24 10:13:27 ned git[57684]: fatal: unable to get password from user
Jan 24 10:13:27 ned git[57681]: error: failed to prefetch remotes
Jan 24 10:13:27 ned git[57681]: error: task 'prefetch' failed
Jan 24 10:13:27 ned systemd[2367]: git-maintenance@hourly.service: Main process exited, code=exited, status=1/FAILURE
Jan 24 10:13:27 ned systemd[2367]: git-maintenance@hourly.service: Failed with result 'exit-code'.
Jan 24 10:13:27 ned systemd[2367]: Failed to start Optimize Git repositories data.
lines 1-16/16 (END)
This is weird because if I run the command locally (stored in ~/.config/systemd/user/git-maintenance@.service) it works.
Logs
Adding trace option gives little information. With the modified the command line in ~/.config/systemd/user/git-maintenance@.service like this:
From:
ExecStart="/usr/local/lib/git-core/git" --exec-path="/usr/local/lib/git-core" -c credential.interactive=false -c core.askPass=true for-each-repo --config=maintenance.repo maintenance run --schedule=%i
To:
ExecStart=bash -c 'WSLENV=$WSLENV:GCM_TRACE:GIT_TRACE GCM_TRACE=1 GIT_TRACE=1 "/usr/local/lib/git-core/git" --exec-path="/usr/local/lib/git-core" -c credential.interactive=false -c core.askPass=true for-each-repo --config=maintenance.repo maintenance run --schedule=%i'
Then,
@ systemctl --user status git-maintenance@hourly.service
× git-maintenance@hourly.service - Optimize Git repositories data
Loaded: loaded (/home/ned/.config/systemd/user/git-maintenance@.service; static)
Active: failed (Result: exit-code) since Wed 2024-01-24 10:29:14 KST; 1min 57s ago
TriggeredBy: ● git-maintenance@hourly.timer
Process: 58557 ExecStart=bash -c WSLENV=$WSLENV:GCM_TRACE:GIT_TRACE GCM_TRACE=1 GIT_TRACE=1 "/usr/local/lib/git-core/git" --exec-path="/usr/local/lib/git-core" -c credential.interacti>
Main PID: 58557 (code=exited, status=1/FAILURE)
CPU: 80ms
Jan 24 10:29:14 ned bash[58560]: 10:29:14.150995 run-command.c:659 trace: run_command: git-remote-https origin https://github.com/<redacted>/<redacted>
Jan 24 10:29:14 ned bash[58561]: 10:29:14.425922 run-command.c:659 trace: run_command: '/usr/local/bin/git-credential-manager get'
Jan 24 10:29:14 ned bash[58561]: fatal: unable to get password from user
Jan 24 10:29:14 ned bash[58558]: error: failed to prefetch remotes
Jan 24 10:29:14 ned bash[58558]: error: task 'prefetch' failed
Jan 24 10:29:14 ned bash[58558]: 10:29:14.524122 run-command.c:659 trace: run_command: git commit-graph write --split --reachable --no-progress
Jan 24 10:29:14 ned bash[58570]: 10:29:14.524970 git.c:535 trace: built-in: git commit-graph write --split --reachable --no-progress
Jan 24 10:29:14 ned systemd[2367]: git-maintenance@hourly.service: Main process exited, code=exited, status=1/FAILURE
Jan 24 10:29:14 ned systemd[2367]: git-maintenance@hourly.service: Failed with result 'exit-code'.
Jan 24 10:29:14 ned systemd[2367]: Failed to start Optimize Git repositories data.
- Dominant language
- C#
- Stars
- 9.3k
- Forks
- 2.9k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 14
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from git-ecosystem/git-credential-manager
-
auth-issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 52/100
git-ecosystem/git-credential-manager#2435 · 1 comment ·
-
auth-issue
Difficulty 3/5 1-2 days Newbie friendliness 62/100
git-ecosystem/git-credential-manager#2426 · 2 comments · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
git-ecosystem/git-credential-manager#2424 · 3 comments ·
-
auth:entra enhancement platform:linux
Difficulty 4/5 3-5 days Newbie friendliness 45/100
git-ecosystem/git-credential-manager#2360 · 3 comments ·
All issues in git-ecosystem/git-credential-manager
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SubtitleEdit/subtitleedit#15108 · 1 comment ·
-
area/docs-content Bug pulumi/docs
Difficulty 1/5 1-3 hours Newbie friendliness 94/100
-
agentic-workflows untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100