Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you reverse the relationship between a git repository and its clone?

Tags:

git

A git clone is set up to support pushing/pulling back into the original repository. How do I use git-remote (and/or other commands, configuration files, etc.) to change the two repositories such that the original will now act like the clone, pushing and pulling into it by default, and the clone will now act as the original, with no knowledge of the clone?

like image 960
skiphoppy Avatar asked Feb 16 '09 18:02

skiphoppy


People also ask

What is git clone mirror?

git clone --mirror In addition, --mirror will clone all the extended refs of the remote repository, and maintain remote branch tracking configuration. You can then run git remote update on the mirror and it will overwrite all refs from the origin repo.


1 Answers

Issue these commands on what used to be the remote:

% git remote add origin user@machine:/path/to/repo
% git config branch.master.remote origin
% git config branch.master.merge  refs/heads/master
% git pull

Then on the old clone:

% git remote rm origin
like image 174
Paul Beckingham Avatar answered Oct 04 '22 11:10

Paul Beckingham