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 /
?
The first time you perform a push to GitHub, you are prompted for your username and password. Simply provide your GitHub username and the access token and your files are uploaded to GitHub. Use your GitHub personal access token as your password when you perform a git push to GitHub operation.
In the upper-right corner of any page, click your profile photo, then click Settings. In the left sidebar, click Developer settings. In the left sidebar, click Personal access tokens.
Replace all /
with their url-encoded representation %2F
.
When you generate token from bitbucket, 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.
! # $ & ' ( ) * + , / : ; = ? @ [ ]
%21 %23 %24 %26 %27 %28 %29 %2A %2B %2C %2F %3A %3B %3D %3F %40 %5B %5D
In your case, you need to replace / with %2F.
Ref: https://fabianlee.org/2016/09/07/git-calling-git-clone-using-password-with-special-character/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With