Home > Mobile >  Git connects to different address than given for origin
Git connects to different address than given for origin

Time:12-19

when I use

git remote -v

I receive

origin  [email protected]:user/repo.git (fetch)
origin  [email protected]:user/repo.git (push)

Which looks quite fine, but if I then try to

git push origin

I receive

\302\226\302\[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

After I checked and reassigned the ssh keys for a thousand times I became suspicious about the address and tried

git push [email protected]:user/repo.git

And it worked like a charm. Any idea where I can fix that?

CodePudding user response:

It looks like you've got some Unicode control characters (specifically two U 0096 characters) in your remote URL. You can fix this by doing this:

$ git remote set-url origin [email protected]:user/repo.git

That will set the remote URL to the right thing, and then you should be able to push and pull as normal.

  • Related