The design of Git does not allow this kind of access-control. You can create separate repos for dir1 and dir2, and give appropriate permissions for each of those repos, but you can’t restrict access to single directories inside a Git repo.
More Related Contents:
- After $git push -u origin main command, Git bash is not requesting any authentication literally does nothing
- Pushing to Git returning Error Code 403 fatal: HTTP request failed
- How can I delete all Git branches which have been merged?
- Git push existing repo to a new and different remote repo server?
- Can’t push to GitHub because of large file which I already deleted
- .gitignore after commit [duplicate]
- Message “Support for password authentication was removed. Please use a personal access token instead.”
- How to remove a dangling commit from GitHub?
- Import existing source code to GitHub
- Difference between Git and GitHub
- gpg failed to sign the data fatal: failed to write commit object [Git 2.10.0]
- Authenticate Jenkins CI for Github private repository
- How to git fetch efficiently from a shallow clone
- How are commits counted by the GitHub contributions graph?
- How can I fork my own GitHub repository?
- How to apply unmerged upstream pull requests from other forks into my fork?
- git diff between cloned and original remote repository
- How to link to a specific line number on GitHub
- Pushing from local repository to GitHub hosted remote
- Jenkins linking to my local git repository
- Pull request vs Merge request
- Git: Remove committed file after push
- Git: Merge a Commit into a different Branch
- How do I contribute to other’s code in GitHub? [closed]
- Merge pull request to a different branch than default, in Github
- Adding self-signed SSL certificate without disabling authority-signed ones
- Jenkins-Build when a change is pushed to GitHub option is not working
- Git LFS refused to track my large files properly, until I did the following
- How to pull remote branch from somebody else’s repo
- GitHub Api download zip or tarball link