A Question: I have an existing git repository with a working directory. I want to begin sharing this repository with a team. I have done the following: git clone --bare repo_dir repo_dir.git and had the team clone the repo_dir.git. Now I want repo_dir to stay up-to-date with any changes pushed to the bare repo. The approach was to just remove the remote origin from repo_dir.git and add a remote origin to repo_dir pointing to the repo_dir.git. That is:

cd repo_dir.git
git remote rm origin
cd ../repo_dir
git remote add origin ../repo_dir.git

I tried updating the original repo: git pull origin master and it seemed to work fine but I am concerned that there may be some other configurations that, left unchanged, will lead to weird behavior. Is it ok to treat this original repo as a clone of the bare repo or must I make other changes? Does anyone have any insight here?

Thanks!

1

There are 1 best solutions below

0
On

Is it ok to treat this original repo as a clone of the bare repo or must I make other changes?

Yes: in a distributed VCS, any repo can be the upstream repo of another.

The only thing to be careful (but not in your case), is the nature of potential hooks that you could trigger when pushing to a new upstream repo.
Since this bare repo is quite recent, this doesn't apply.