1

I made a mess of my git settings. When I check my remote settings with

git remote -v

I get

origin  https://cx1964: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@github.com/cx1964/home_claude_bin_scripts.git (fetch)
origin  https://cx1964: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@github.com/cx1964/home_claude_bin_scripts.git (push)
origin  https://github.com/cx1964/cx1964Repos_fastAPI_React_Redis.git (push)

But I want

origin  https://github.com/cx1964/cx1964Repos_fastAPI_React_Redis.git (fetch)
origin  https://github.com/cx1964/cx1964Repos_fastAPI_React_Redis.git (push)

How can I achieve this?

  • 2
    Use [`git remote set-url`](https://git-scm.com/docs/git-remote) to manage the remotes. – axiac Apr 08 '22 at 13:55
  • 1
    @user2588998 It seems to me like your repo is in a weird state. I would tackle this by manually editing `.git/config`, or at least inspecting it. You might need to clean up what appears under `[remote "origin"]` in there. – joanis Apr 08 '22 at 15:01
  • 1
    In fact, it might be helpful if you add to the question what appears under `[remote "origin"]` in that repo's `.git/config` file, it's likely to be informative. – joanis Apr 08 '22 at 15:06

1 Answers1

0

git remote remove origin to delete your current origin remote then recreate it with

git remote add origin https://github.com/cx1964/cx1964Repos_fastAPI_React_Redis.git

you can also change the remote url with

git remote set-url origin https://github.com/cx1964/cx1964Repos_fastAPI_React_Redis.git
SuperRem
  • 16
  • 2
  • When I use **git remote remove origin** and **git remote add origin github.com/cx1964/cx1964Repos_fastAPI_React_Redis.git** I still get **origin cx1964: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@github.com/… (fetch)** **origin cx1964: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@github.com/… (push)** **origin github.com/cx1964/cx1964Repos_fastAPI_React_Redis.git (push)** When I use **git remote -v** – user2588998 Apr 08 '22 at 14:26
  • Do I have to provide more information to fix it? – user2588998 Apr 08 '22 at 14:28
  • Did you try with `git remote set-url` ? – SuperRem Apr 08 '22 at 14:31
  • yes. When I two times use **git remote set-url --delete origin . I get at the second time the error **fatal: could not unset 'remote.origin.url'** – user2588998 Apr 08 '22 at 14:37
  • **git remote -v** gives two line, but with wrong urls – user2588998 Apr 08 '22 at 14:38
  • I want the url **https://github.com/cx1964/cx1964Repos_fastAPI_React_Redis.git** – user2588998 Apr 08 '22 at 14:39
  • It seems that someone had a similar issue try to check [here](https://stackoverflow.com/questions/42981272/fatal-could-not-unset-remote-origin-url) – SuperRem Apr 08 '22 at 14:41
  • Sorry that link does does not fix the problem. I think there something more going on (see my new problem [link](https://stackoverflow.com/questions/71816377/how-can-i-repair-my-git-to-clone-a-repro) . – user2588998 Apr 10 '22 at 12:02