I want to create a git repo that will include scripts in /nfsdrive/sbin/ and the services that activate these scripts—which reside in /etc/init.d/.

I've searched the documentation and the relevant discussions, but could not find if the above is at all possible, much less how to accomplish it.

Is it possible to create a git repo that will comprised of files residing in NFS and files in a system directory?

  • 1
    Questions about how to use a tool should be asked on StackOverflow. This community is for conceptual questions about software engineering. You appear to have a concrete question about a tool, which makes this off-topic for this community. Consider rephrasing your question to make it on-topic (see help center) or post this on StackOverflow. Jul 22, 2022 at 19:45
  • Thanks, @greg. I created stackoverflow.com/questions/73085839/…. Should I delete the current question at softwareengineering.stackexchange.com/posts/439976?
    – boardrider
    Jul 22, 2022 at 20:40
  • Only delete this question if it is a duplicate of what you posted on StackOverflow. Jul 22, 2022 at 21:09
  • Perhaps you could simply set up 2 separate git repos, one in each of those folders.
    – David Cary
    Feb 9, 2023 at 20:13
  • @GregBurghardt: this doesn't seem to be a question about programming, so I don't see how StackOverflow would be better. Perhaps you meant superuser.com ?
    – David Cary
    Feb 9, 2023 at 20:15

1 Answer 1


This seems like a question about how to use a tool, but I will attempt a conceptual answer anyhow.

Instead of creating your git repository using the same file structure as a real server, consider storing the files all in one folder, but arranged into sub folders to represent where they should go. You could include a shell script that acts as an installer.

Basically, Git is good at storing files and version control, but not good at deployment. This is why version control and the logic for deploying code and configuration are their own specialized tools.

An idea for the structure of the repository could be:


If in your home directory, a git clone <your repo> would result in this file structure:

/users/boardrider/<your repo>/nfsdrive/sbin/
/users/boardrider/<your repo>/etc/init.d/
/users/boardrider/<your repo>/install.sh

Then you can execute install.sh with root permissions. This shell script could simply copy the files in <your repo> to their respective locations on the real machine.

It is a good idea to separate the storage of code from the logic that deploys it. This allows you to use specialized tools that are good at their respective jobs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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