Multiple Git repositories in one directory

I would like to deploy a directory to multiple developers having different permissions. So this is one thing Git cannot do. What about creating two repositories in one directory and assigning them different file lists by excluding files managed by the other repository with the .gitignore file.

Example: /www/project/.git for all files except in /www/project/css
/www/project/css/.git
-> only files in this directory

  • How to get old Git branches onto GitHub?
  • 'rm' + 'svn update' equivalent in Git?
  • git pull --rebase lost my commit
  • Regroup git repositories and keep branches
  • Symfony2, AWS Beanstalk: how to push vendor as files not git-submodules to repo
  • Git Pull Aborting
  • Has anyone tried this solution? Or are there any better ways to handle this issue?

  • What's the difference between git reset file and git checkout file?
  • .gitignore files not ignored when pulling remote changes
  • git commit get fatal error “fatal: CRLF would be replaced by LF in”
  • Named stages as git checkout-index parameters
  • Importing a patch from one git repo into another
  • Are there any accepted “best” or canonical books on SCM for developers?
  • 3 Solutions collect form web for “Multiple Git repositories in one directory”

    A less annoying approach than git-submodules (which are a pain to use) is gitslave Gitslave creates a group of related repositories—a superproject repository and a number of slave repositories—all of which are concurrently developed on and on which all git operations should normally operate; so when you branch, each repository in the project is branched in turn. Similarly when you commit, push, pull, merge, tag, checkout, status, log, etc; each git command will run on the superproject and all slave repositories in turn. This sort of activity may be very familiar to CVS and (to a lesser extent) Subversion users. Gitslave’s design is for simplicity for normal git operations.

    I’ll also point you to etckeeper which does track permissions. It has its own peculiarities which may or may not make it usable for you.

    Finally, I’ll note you can have a custome post-checkout script which sets the appropriate permissions on the appropriate files/directories.

    It sounds like you want submodules. Any sub directories from the main repo can be submodules which are different git repositories.

    https://book.git-scm.com/book/en/v2/Git-Tools-Submodules

    http://git-scm.com/docs/git-submodule

    I suspect you’re much better off permissioning your developers for comimits in either/both repositories. See also this server fault question.

    Git Baby is a git and github fan, let's start git clone.