开发者

How to make cloned repo shared?

开发者 https://www.devze.com 2023-04-03 05:30 出处:网络
How can I make my cloned repo to be cloned by others via ssh, so that my team members can push the changes and in the same time I can pull changes from origin. 开发者_如何学编程

How can I make my cloned repo to be cloned by others via ssh, so that my team members can push the changes and in the same time I can pull changes from origin. 开发者_如何学编程

master repo (other site) clone via git --> my repo <--> clone by my team mates

--> only pull

<--> pull and push


It's not possible to push changes into a repo that has a checked-out working copy around it. (You can, however, pull into a repository with an associated working copy) Therefore, the first thing to do is to create a bare clone with git clone --bare.

This clone has to be made reachable by you and your team members, a nice overview of all the possible way to do that is 8 ways to share your git repository.

Do note:

  • If you have this clone on your own machine, you have to do a "normal" clone of this repository to create your own working copy, you can't work directly in the bare repository (by definition).
  • Since you now have two git repositories to manage (the bare clone and your working copy) it's a bit more work to keep everything in sync. If it's okay that you pull everything from your team members instead of having them push to you, you can get away with using only your normal working copy, or a lot less overhead.

Here's what it'd look like:

(other site) --> (bare clone) <--> (your working clone)
                              <--> (your team mates)

With only pulls, it's slightly simpler:

(other site) --> (your working clone) <-- (your team mates)

The push-pull setup does have a clear and obvious master.


It depends how you access the repo, you can use ssh, git, http or simple file share.

I use file share (Windows), since all developers are in one networks. So, as soon as you cloned the repo and share repository folder. Another developer can:

git remote add some_name //you_ip_address/name_of_repo.git
git fetch some_name 

If another developer has no such repository, he first can clone from you

git clone //you_ip_address/name_of_repo.git
0

精彩评论

暂无评论...
验证码 换一张
取 消