-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
git 2.35.2 breaks nixos-rebuild with flake repo owned by non-root user #169193
git 2.35.2 breaks nixos-rebuild with flake repo owned by non-root user #169193
Comments
This also breaks |
Note: An extra hacky work around if you can't modify root's gitconfig (say, because you'd need to use this same flake to do so) is to |
Can we also build the config using unprivileged |
Such a nonsense CVE 🙄 If people can drop malicious files on your filesystem you are already fucked. |
Workaround to get your machines updated $ sudo git config --global --add safe.directory /etc/nixos |
Just found out that nixos-rebuild has a |
I am questioning myself: Why is this not the default? Sounds like it should be to me. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/sudo-nixos-rebuild-switch-not-a-git-repository/18763/2 |
lets keep this open until something is done so this works by default |
Requires `sudo git config --global --add safe.directory /home/khushraj/nixos-config/` see NixOS/nixpkgs#169193
(not sure if its worth opening an issue about) For extra dwim, it'd be cool if |
To spell out @NickCao 's work-around, you can use |
@hqurve this seems like the best way to fix this moving forward. |
Is there a reason not to make |
Having the toggle is desirable for systems where you don't have sudo, and want to hand-craft permissions with any of the non-sudo permissions management options instead. But in those cases it's not really harmful and should show a pretty obvious error message. I can't really see a reason not to invert that flag. |
We should also probably replace |
Should be fixed by NixOS/nix#6440 in nixos/nix. Should probably be backported to at least 2.8 (and perhaps 2.7), cc @thufschmitt @edolstra |
This comment was marked as resolved.
This comment was marked as resolved.
I found that this also works fine |
with upgrade to nix 2.9.0, this is started happening to me again |
The nix bump isn't in any of the channels yet, https://nixpk.gs/pr-tracker.html?pr=175541 |
After upgrade nix to 2.9: |
This also affects |
Describe the bug
After upgrading to git 2.35.2 (which is the version currently in nixos-unstable-small), running
sudo nixos-rebuild switch
with a flake repo owned by non-root user would result in a cryptic error message sayingThe underlying reason is that due to the fix for CVE-2022-24765, git now effectively treats any directory not owned by the calling user as not a git repo. A temporary workaround would be to add the repo to
safe.directory
entry of the root user's git config. A possible long term fix is to only usesudo
or others means for privilege elevation when absolutely required innixos-rebuild
.Notify maintainers
@Profpatsch
Metadata
The text was updated successfully, but these errors were encountered: