How does one git config --system on an Atomic Fedora?

I am getting the following error if I try to set a git config globally (system-wide).

➜  git config --system core.filemode false
error: could not lock config file /etc/gitconfig: Permission denied

Note that it does work if I prefix with sudo, but that feels wrong somehow… Is it?

It seems the lock was coming from something else. I am able to run without sudo now, and it is having the desired effect!

First, why are you trying to use --system? This implies that you have multiple users that need to share some baseline config. Is that really the case?

If not, then just drop the --system and let the change be placed into ~/.gitconfig or ~/.config/git/config whichever is the case for you.

If you do really need to use --system, then …

The reason you need to use sudo is:

  • bluefin (and probably the rest) do not ship an /etc/gitconfig file
  • /etc is owned by root

Go ahead and issue the command with sudo and then (also using sudo) change the file’s ownership as you would like.

The /etc filesystem is read-write. Adding files is fine and they will be propagated through system updates.

If interested, I wrote an article here that goes into more details.

1 Like

I am trying out a new setup where the code lives primarily on my NAS, mounted via SMB, and that results in every file in every repo appearing to have been changed, when it is really 644 => 755 permissions. So I want to globally ignore filemode.

Would changing the file mode and dir mode for your mount command fix the problem?

Oh, does that sound familiar. I had the same problem ~10 years ago when I built my first NAS.

Where I landed was to ditch SMB (and then later ditch NFS) and installed a local git server. I now have Soft Serve running in a container on a Raspberry Pi 4B+. It is awesome. Lightweight, easy to work with and no more SMB perms / auth errors to administrate.

Ignoring the filemode is not really what you want. I am just saying.

Don’t forget about time as well … make sure your desktop and NAS server are using the same time source, one does not have more latency than the other, etc. Experimentation is a great way to learn. I did the same thing. But then gave up on SMB (and NFS). I didn’t need another job. :wink:

Note I am not commenting on what you are doing to try to solve your SMB problem - just how you are going about configuring git.

The purpose of git config --system ... (/etc/gitconfig) is to provide baseline config for all USERS of your system. So unless you have multiple USERS that need to use git operations against your mounted dirs, than you really do not need to do that.

In my case, I mounted my source dir as ~/src and only my user (my own policy) was allowed to perform git operations on those dirs. That kept everything in my home dir where it was easy to backup/restore (or exclude from backup).

So git config --global ... is what I use. This writes to ~/.config/git/config if that dir exists or ~/.gitconfig if it does not. Note you should create the ~/.config/git dir manually before using git config --global set ....

That interpretation of the word “global” is all I needed. Then when I moved to bluefin I did not need to change that behavior at all.

For my git setup, “global” means $HOME.

Thanks to @JohnAtl for referencing the docs so I didn’t need to. I also find the arch wiki really helpful. Samba is Samba regardless of the OS on which it is running.

Good luck!

Yeah, :smile: that’s entirely accurate. I have been trying to move into this new atomic world since I found it a few days ago, and all my work drives were encrypted APFS, so I couldn’t access any of my TB of data until I moved it over to a drive linux could read. I tried apfs-fuse; it did not work at all.

Part of me wants to setup the NAS for remote access - but the reality is I don’t think I’ll get to it. I should give up on the SMB. Thanks for talking sense into me!

P.S. I just built my first spin! GitHub - pboling/galtzo: aurora-dx-hwe:latest + NordVPN + 1Password + Ruby build deps

1 Like

APFS? Wow. OK - I get the use case now. Way out of my comfort zone. I struggle to draw stick figures unless I write a program to do it for me :wink:

Kudos on the custom image!