1

I want to clone a git repo from Github with the command

git clone [email protected]:rgov/Thunderbolt3Unblocker.git

but I get

Cloning into 'Thunderbolt3Unblocker'...
fatal: unable to access 'https://github.com:rgov/Thunderbolt3Unblocker.git/': Port number ended with 'r'

It seem git interprets username "rgov" as port number?

The git version is 2.27.0

4
  • git clone https://username:[email protected]/rgov/Thunderbolt3Unblocker.git Commented Aug 29, 2021 at 6:48
  • 1
    What you’ve written normally works, but try git clone ssh://[email protected]/rgov/Thunderbolt3Unblocker.git to see if there’s an improved error message? Maybe your Git doesn’t support SSH? Commented Aug 29, 2021 at 6:49
  • 1
    Please edit your question to include the output of git config -l --show-origin | grep insteadof as a code block. Also you should not put passwords or other secrets in the URL. Commented Aug 29, 2021 at 8:14
  • 1
    Git downcases it when parsing it, and so when printing it with git config -l. I checked, because I also write it insteadOf. Commented Aug 29, 2021 at 13:18

1 Answer 1

1

Check git config --global -l output for any insteadOf directive, like:

git config --global url."https://github.com".insteadOf [email protected]

That would explain why [email protected] whas replaced by https://github.com

Note that this directive is not well written: it should have been:

git config --global url."https://github.com/".insteadOf [email protected]:
                                          ^^^                        ^^^

That would at least gave you a valid HTTPs URL:

https://github.com/rgov/Thunderbolt3Unblocker.git
                 ^^^

But if you want to use SSH, delete that insteadOf directive from your global git configuration.

git config --global --unset-all url."https://github.com/".insteadof

You can also

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.