Setup: At work we have a git repo where our scripts are. These scripts need to be accessible on all our client linux machines (~400). The current solution is to have a file server, which regularly pulls the main branch. This then is mounted (nfs + autofs).
Question: Is there an easy way to mount a remote git branch read only?
I'm aware of GitFS, but this seems to be overkill. I'm looking for something lightweight, preferably in-memory, i.e. without checking stuff out on disk. I only need access to one branch, no history.
Edit: To clearify this: I want to avoid pulling and cronjobs and stuff like this. Best would be something which transparently mounts a remote git repository much like a read only nfs mount.
Question: Is there an easy way to mount a remote git branch read only?
Yes you can do it in several ways.
Both bundle & archive are a read-only repository.
git bundle
# Clone the desired branch (-b flag)
# and pack it into a bundle with the desired name
git clone repo.bundle repo-copy -b master
The output of this is a single file containing the desired branch in a read-only mode since it's not a git repository.
git archive
similar to the above bundle command
# Create a tar archive that contains the contents of the latest commit
# on the current branch, and
#extract it in the /var/tmp/junk directory.
git archive --format=tar --prefix=junk/ HEAD | (cd /var/tmp/ && tar xf -)