Clonning of a single file or folder is possible

Intech Kalpesh
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!
March 20, 2018

If my private repository project has two sub project/folder and need to provide access of only one project/folder to any user. then is it possible?

3 answers

1 accepted

0 votes
Answer accepted
Lonnie
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 20, 2018

Also to complete my answer. If you have not already cloned the repo you can do:

git clone <git_repository>.git <path_to_desired_file>

Example:

git clone https://lonnie@bitbucketdc/scm/al/hello-alexa.git ./hello-alexa/README.md

Cloning into './hello-alexa/README.md'...

remote: Counting objects: 223, done.

remote: Compressing objects: 100% (106/106), done.

remote: Total 223 (delta 115), reused 220 (delta 114)

Receiving objects: 100% (223/223), 2.20 MiB | 0 bytes/s, done.

Resolving deltas: 100% (115/115), done.
ls -l hello-alexa/

total 0

drwxr-xr-x   3 lonnie  staff    96B Mar 20 12:35 ./

drwxr-xr-x   5 lonnie  staff   160B Mar 20 12:35 ../

drwxr-xr-x  13 lonnie  staff   416B Mar 20 12:35 README.md
0 votes
jredmond
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 20, 2018

@Intech Kalpesh, are you asking how to get updates for a single folder, or are you asking if it's possible to restrict access to folders within a repo? (The former is possible, as @Lonnie has helpfully answered, but the latter is not possible in either Git or Mercurial.)

0 votes
Lonnie
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 20, 2018

Hello Team, Yes you can check out a single file or folder via git

You can use the following:

git checkout orgin/master -- path/to/file  

 

path/to/file will checkout the particular file or folder from the downloaded changes (origin/master).

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events