Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create a shared repo using "git clone"?

Tags:

git

clone

init

The "git init" command has a parameter --shared which, from my reading, creates a repo with permission bits set to allow multiple people to access and update the repo.

I want to create the same type of repo but this time using "git clone". It too has a --shared parameter but from my reading does something totally different.

How can I clone a repo so that the cloned repo has the same permission bits as a "git init" with the --shared parameter ?

like image 326
GOVarney Avatar asked May 01 '26 10:05

GOVarney


1 Answers

You can try the workaround of:

git init --shared aFolder
cd aFolder
git remote add origin /url/repo/to/clone
git fetch
git switch main

That way, you init first, then import the remote repository, instead of cloning it directly.

like image 141
VonC Avatar answered May 04 '26 01:05

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!