2

Cloning a repo can be done with

git clone https://username:password@github.com/username/repository.git

However, when the password contains a forward slash, this doesn't work. Error is:

error: Couldn't resolve host 'klaus777:password' while accessing 
https://klaus777:password/.@bitbucket.org/romeo/server-code.git/info/refs

fatal: HTTP request failed

If I URL Encode the Slash, I get the following error:

error: The requested URL returned error: 401 while accessing 
https://klaus777:password%2F%2E@bitbucket.org/romeo/server-code.git/info/refs

fatal: HTTP request failed

Hence, the question: How do you deal with forward slash in password?

PS. If I remove password from URL and provide it when prompted, everything works just fine.

stuartd
  • 70,509
  • 14
  • 132
  • 163
Klaus
  • 2,328
  • 5
  • 41
  • 62

1 Answers1

2

A percent encoding for forward slash should be %2F alone, check if you need to encode the '.' (%2E) that you seem to also have in your password.

https://klaus777:password%2F.@bitbucket.org/romeo/server-code.git

That doesn't seem to work for GitHub though: the OP Klaus confirms in the comments:

I changed the password.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Unfortunately, encoding only the forward slash does not work either. – Klaus Jul 14 '14 at 02:58
  • @Klaus no need to encode the '.' (unreserved character). But for testing, can you check, for the '/', if this would work better? `%252F` or `%25252F` – VonC Jul 14 '14 at 06:30
  • @Klaus and make sure you didn't activated the 2FA (2 Form Authentication) on GitHub for your account, because then you would have to generate a token as a password, not use your regular account password. – VonC Jul 14 '14 at 06:32
  • I gave up. I changed the password. Unfortunately, these suggestions did not work either. – Klaus Jul 14 '14 at 09:13
  • @Klaus Ok, I have included your conclusion in the answer for more visibility. – VonC Jul 14 '14 at 09:22