Search code examples
gitbitbucketaccess-tokengit-clone

How can I git clone over https with a personal access token containing '/'?


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 /?


Solution

  • Replace all / with their url-encoded representation %2F.