I need to have an USB stick with a git repository on it because i may want to change things in the repo on several computers (centos and redhat)

The repository uses symbolic links so this stick cannot be formatted in FAT32.

Hence, I formatted my usb key in EXT4. But my computers don't share the same users (otherwise they would have been connected and i would use ssh to clone and stuff)

So, when I put a file on Computer A with user A', I cannot read it from computer B with user B' (and so on with C-C' D-D'...)

I though of making every file rwx for 'others', but git saves these rights and I don't want to have some text file being executable (it causes trouble while packaging with rpmbuild: it does not like x flag on text file and rightfully expects a shebang on top of them...)

Is there a way to avoid that? like an hidden universal group or something like that?

For information I cannot be root on all computers.

Any help appreciated :)

  • Could you try storing the repo as a bare repo on the stick? Not sure if that helps with the final permissions; you may have to chmod the bare repo contents before umounting the stick so that others have write access, but it shouldn't change the actual stored permissions (since Git anyway only stores executable bits for the owner). – slhck Dec 13 '19 at 10:05
  • Related. – Kamil Maciorowski Dec 13 '19 at 10:06
  • @slhck I've thought of that but I wanted to avoid it because it means to clone the repo on every computer, hence starting to be complicated to merge to the stick because of my users not really used to git. I may have to do that... – A. Ocannaille Dec 13 '19 at 10:17
  • @KamilMaciorowski thanks for this link, I didn't came accross, I did not come across it during my research – A. Ocannaille Dec 13 '19 at 10:19
  • Git does not use symbolic links in its repository format by default. Do you really need them? Or did you perhaps create a non-bare repo on the USB drive? – Daniel B Dec 13 '19 at 10:27

After somes tries, I solved my problem with @slhck solution, i.e. having a bare repo on the stick and clone it on each computer needed.

It has cons, like having to recompile some tools in the repo on each computer, and to be rigourous about pushing and merge, but it works.

This is an answer about my specific problem which was with a git repo. My Question title is wider and a promising related solution has been linked by @KamilMaciorowski

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.