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?
设置git clone以支持推/拉回原始存储库。我如何使用git-remote(和/或其他命令,配置文件等)更改两个存储库,以便原始文件现在将像克隆一样,默认情况下推送和拉入它,克隆现在将采取行动作为原始,不知道克隆?
2 个解决方案
#1
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
#2
You just have to edit the .git/config file in both repository and change the "url" of remote "origin"
您只需编辑两个存储库中的.git / config文件并更改远程“origin”的“url”
You can therefor use the git-config command (see the man for options) in order to change global option for a git repository.
因此,您可以使用git-config命令(请参阅man for options)以更改git存储库的全局选项。
#1
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
#2
You just have to edit the .git/config file in both repository and change the "url" of remote "origin"
您只需编辑两个存储库中的.git / config文件并更改远程“origin”的“url”
You can therefor use the git-config command (see the man for options) in order to change global option for a git repository.
因此,您可以使用git-config命令(请参阅man for options)以更改git存储库的全局选项。