Reputation: 2462
I am trying to clone a repository from Bitbucket using a personal access token:
$ git clone https://{user}:{token}@bitbucket.repo/myrepo.git
Bitbucket just created four times in a row an access token containing a forward slash (/
). Using such a token with git clone
produces the following error:
fatal: unable to access 'https://{user}:{token}@bitbucket.repo/myrepo.git': URL using bad/illegal format or missing URL
The fifth token (without a /
) worked. So, how can I git clone
over https with a personal access token containing /
?
Upvotes: 9
Views: 12501
Reputation: 1506
When you generate token from git, it is more likely to generate special characters in the access token. While you pass these tokens as is with the reserved special characters, you will end up with an error. To overcome that you need to replace the special characters with the corresponding characters.
In your case, you need to replace / with %2F.
! # $ & ' ( ) * + , / : ; = ? @ [ ]
%21 %23 %24 %26 %27 %28 %29 %2A %2B %2C %2F %3A %3B %3D %3F %40 %5B %5D
Ref: https://fabianlee.org/2016/09/07/git-calling-git-clone-using-password-with-special-character/
Upvotes: 10