You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Problem:
We have some sensitive information in one of our code branches.
And for now, we need to give access to one user because we don't want the user to checkout that particular branch in clone or any other pull command.
Hi @Ankit Verma and welcome to the community!
It is not possible to restrict user access to a certain branch or branches only. When you grant a user access to a repo, this user can clone and pull all of the repo's branches, there is no way to prevent that.
You may want to look into submodules if you want to restrict access:
https://git-scm.com/book/en/v2/Git-Tools-Submodules
https://www.atlassian.com/git/tutorials/git-submodule
Instead of storing the code you don't want to share in a separate branch, you could create a repo instead and make it a submodule of your main repo. You can then grant access to a user to the main repo, but not to the submodule.
Another option would be to create a fork of your repo, delete the branch(es) you don't want to share from the fork, and then grant this user access to the fork. Please keep in mind that this will work if the branch is not the repo's main one, and if it has not been merged into other branches. If the branch you don't want to share has been merged into other branches, you would need to delete these other branches from the fork as well.
If you have any questions, please feel free to let me know.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.