Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,418
Community Members
 
Community Events
184
Community Groups

How i can give a single branch access of my repository access to any user.

Ankit Verma
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Apr 23, 2023

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. 

 

 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Apr 24, 2023

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events