Reputation: 65
There is no remote repository for this project yet but it has a remote set in its config and someone did that for some reason so I won't change it. The original repository is in /home/me/repo1/.git and I ran git clone /home/me/repo1/.git
while in /home/me/repo2 so now it's cloned in /repo2
When I go into the cloned repo and run git remote set-url origin http://example.com/asdf/.git
both repositories config's get updated.
I can't fork the repo because I don't have admin access and no access to gh cli or similar tools. Is there a workaround to only update the second repository?
Upvotes: 0
Views: 1034
Reputation:
Cannot simulate the issue here, and it makes sense, since the remote tracking configuration is on a per repository basis, could you please check if the performed steps resemble the steps provided below? The intent of the pwd
commands is to demonstrate the current folder in which the subsequent commands are executed.
$ pwd
/home/user/
$ mkdir repo1
$ cd repo1
$ git init .
Initialized empty Git repository in /home/daniel/Temporary/repo1/.git/
$ git remote add origin http://url.com/repo1.git
$ pwd
/home/user/
$ mkdir repo2
$ cd repo2
$ git clone ../repo1/.git/
Cloning into 'repo1'...
warning: You appear to have cloned an empty repository.
done.
$ pwd
/home/user/repo2/repo1
$ git remote set-url origin http://url.com/repo2.git
$ pwd
/home/user/repo1
$ git remote -v
origin http://url.com/repo1.git (fetch)
origin http://url.com/repo1.git (push)
-----
$ pwd
/home/user/repo2/repo1
$ git remote -v
origin http://url.com/repo2.git (fetch)
origin http://url.com/repo2.git (push)
Upvotes: 4