-
-
Notifications
You must be signed in to change notification settings - Fork 17.5k
git: move credential helpers to exec path #347515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
khaneliman
merged 1 commit into
NixOS:staging
from
joshheinrichs-shopify:git-creds-on-exec-path-2
Apr 21, 2025
Merged
git: move credential helpers to exec path #347515
khaneliman
merged 1 commit into
NixOS:staging
from
joshheinrichs-shopify:git-creds-on-exec-path-2
Apr 21, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffbb090 to
94a8a84
Compare
Currently if the credential helpers packaged with git aren't on your PATH, git will fail to locate them. This most notably affects git maintanence[1] which generates systemd units / launchd agents that invoke git directly without setting PATH. Home Manager is also able to generate maintanence units for systemd and does not set PATH[2], meaning credential helpers will not work without additional configuration. Moving the credential helpers to git's exec path[3] allows git to locate them regardless of how PATH is set, and matches the packaging of Fedora[4] and Homebrew[5]. Typically credential helpers are not added to PATH unless they are provided by another package separate from git (e.g. git-credential-gcloud). I opted to create symlinks at the old bin paths in case some users were relying on invoking them directly. In practice I doubt this is done much. If we want to slim down git's bin dir I think the symlinks could be removed, and in doing so we'd better match the packaging done in other distributions. [1]: https://git-scm.com/docs/git-maintenance/2.47.1 [2]: https://github.com/nix-community/home-manager/blob/b6fd653ef8fbeccfd4958650757e91767a65506d/modules/programs/git.nix#L619 [3]: https://git-scm.com/docs/git/2.47.1#Documentation/git.txt---exec-pathltpathgt [4]: https://src.fedoraproject.org/rpms/git/blob/rawhide/f/git.spec#_651 [5]: https://github.com/Homebrew/homebrew-core/blob/12120ff79ce009489b958d8271af686d74403859/Formula/g/git.rb#L112
94a8a84 to
74e7f97
Compare
joshheinrichs-shopify
added a commit
to joshheinrichs-shopify/home-manager
that referenced
this pull request
Apr 21, 2025
This doesn't yet work for folks using git-credential-osxkeychain as it isn't placed on git's exec path[1]. I mostly attempted to mimic the agents that git maintanence generates for itself. The settings differ slightly because git configures calandar intervals incorrectly[2], and git started injecting some additional config settings recently[3] which would be good to mimic in another PR. [1] NixOS/nixpkgs#347515 [2] https://lore.kernel.org/git/20250421054633.231069-1-joshiheinrichs@gmail.com [3] git/git@4f55519
joshheinrichs-shopify
added a commit
to joshheinrichs-shopify/home-manager
that referenced
this pull request
Apr 21, 2025
This doesn't yet work for folks using git-credential-osxkeychain as it isn't placed on git's exec path[1]. I mostly attempted to mimic the agents that git maintanence generates for itself. The settings differ slightly because git configures calandar intervals incorrectly[2], and git started injecting some additional config settings recently[3] which would be good to mimic in another PR. [1] NixOS/nixpkgs#347515 [2] https://lore.kernel.org/git/20250421054633.231069-1-joshiheinrichs@gmail.com [3] git/git@4f55519
joshheinrichs-shopify
added a commit
to joshheinrichs-shopify/home-manager
that referenced
this pull request
Apr 21, 2025
This doesn't yet work for folks using git-credential-osxkeychain as it isn't placed on git's exec path[1]. I mostly attempted to mimic the agents that git maintanence generates for itself. The settings differ slightly because git configures calendar intervals incorrectly[2], and git started injecting some additional config settings recently[3] which would be good to mimic in another PR. [1] NixOS/nixpkgs#347515 [2] https://lore.kernel.org/git/20250421054633.231069-1-joshiheinrichs@gmail.com [3] git/git@4f55519
joshheinrichs-shopify
added a commit
to joshheinrichs-shopify/home-manager
that referenced
this pull request
Apr 21, 2025
This doesn't yet work for folks using git-credential-osxkeychain as it isn't placed on git's exec path[1]. I mostly attempted to mimic the agents that git maintenance generates for itself. The settings differ slightly because git configures calendar intervals incorrectly[2], and git started injecting some additional config settings recently[3] which would be good to mimic in another PR. [1] NixOS/nixpkgs#347515 [2] https://lore.kernel.org/git/20250421054633.231069-1-joshiheinrichs@gmail.com [3] git/git@4f55519
6 tasks
khaneliman
approved these changes
Apr 21, 2025
Contributor
khaneliman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
joshheinrichs-shopify
added a commit
to joshheinrichs-shopify/home-manager
that referenced
this pull request
Apr 21, 2025
This doesn't yet work for folks using git-credential-osxkeychain as it isn't placed on git's exec path[1]. I mostly attempted to mimic the agents that git maintenance generates for itself. The settings differ slightly because git configures calendar intervals incorrectly[2], and git started injecting some additional config settings recently[3] which would be good to mimic in another PR. [1] NixOS/nixpkgs#347515 [2] https://lore.kernel.org/git/20250421054633.231069-1-joshiheinrichs@gmail.com [3] git/git@4f55519
Contributor
|
Can merge as-is with the backwards compat, if someone has the appetite for removing the old binary location links and/or deprecating them. They can do it in a follow up PR. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
10.rebuild-darwin: 501+
This PR causes many rebuilds on Darwin and should normally target the staging branches.
10.rebuild-darwin: 5001+
This PR causes many rebuilds on Darwin and must target the staging branches.
10.rebuild-linux: 501+
This PR causes many rebuilds on Linux and should normally target the staging branches.
10.rebuild-linux: 5001+
This PR causes many rebuilds on Linux and must target the staging branches.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently if the credential helpers packaged with git aren't on your PATH, git will fail to locate them. This most notably affects git maintanence1 which generates systemd units / launchd agents that invoke git directly without setting PATH. Home Manager is also able to generate maintanence units for systemd and does not set PATH2, meaning credential helpers will not work without additional configuration.
Moving the credential helpers to git's exec path3 allows git to locate them regardless of how PATH is set, and matches the packaging of Fedora4 and Homebrew5. Typically credential helpers are not added to PATH unless they are provided by another package separate from git (e.g. git-credential-gcloud).
I opted to create symlinks at the old bin paths in case some users were relying on invoking them directly. In practice I doubt this is done much. If we want to slim down git's bin dir I think the symlinks could be removed, and in doing so we'd better match the packaging done in other distributions.
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.
Footnotes
https://git-scm.com/docs/git-maintenance/2.47.1 ↩
https://github.com/nix-community/home-manager/blob/b6fd653ef8fbeccfd4958650757e91767a65506d/modules/programs/git.nix#L619 ↩
https://git-scm.com/docs/git/2.47.1#Documentation/git.txt---exec-pathltpathgt ↩
https://src.fedoraproject.org/rpms/git/blob/rawhide/f/git.spec#_651 ↩
https://github.com/Homebrew/homebrew-core/blob/12120ff79ce009489b958d8271af686d74403859/Formula/g/git.rb#L112 ↩