4

I try to make a clone (mirror) of my bitbucket repo using jenkins execute shell (not the git plugin).

My credentials:

username
passwd

are saved in a variable: myuser The credentials are right. We used this plugin to save the credentials. We're doing exactly the same for some other repo's (on our local git, not bitbucket) and it's working very good.

Now I try:

git clone --mirror https://${myuser}@bitbucket.org/team/repo.git

The error I'm facing is:

fatal: unable to access 'https://****@bitbucket.org/team/repo.git/': Port number ended with 'T'
DenCowboy
  • 13,884
  • 38
  • 114
  • 210
  • Have a look [here](https://stackoverflow.com/questions/45385673/how-to-troubleshoot-an-url-error-with-port-number-ended-with-y). You're mixing SSH urls with https. – Andrejs Cainikovs Nov 02 '17 at 14:28
  • @AndrejsCainikovs I saw that issue too but I don't see what I'm mixing up. I checked here too https://confluence.atlassian.com/bitbucket/clone-a-repository-223217891.html – DenCowboy Nov 02 '17 at 14:29
  • Are you routing through a proxy? – Jim Redmond Nov 02 '17 at 17:35

4 Answers4

5

Was just banging by head around with a similar problem (attempt to clone from Gerrit over HTTPS with random HTTP password generated by Gerrit UI, URL in the form of https://<username>:<password>@<gerrit.repo.url> and getting 'Port Number ended with...' error), and it appears that the password must be properly url-quoted.

Realized that after trying to set git-credentials with 'store' helper and peeking at the file it created :-)

pshchelo
  • 76
  • 1
  • 2
4

We need to encode the URL while passing special characters in the usernames or passwords with http or https protocol. For example if you want to use user#1 in password and want to use it in URL you need to encode the # using %23 and the password becomes user%231.

Reference: https://github.com/curl/curl/issues/1909#issuecomment-331565533

Nasir Ahmad
  • 443
  • 1
  • 7
  • 15
0

For me also git clone was not working. But after adding proper git remote origin it worked.

Step 1. mkdir /local/repo/dir && cd /local/repo/dir
Step 2. git init
Step 3. git remote add origin https://<username>@bitbucket.org/<orgName>/<reponame>.git

Now git pull works without any issue

xxx374562
  • 226
  • 1
  • 8
0

Adding personal token resolved problem. Go to your account - personal access tokens, create token and use it instead of password.

git clone https://username:token@bitbucket.org/.../repo.git
Vyachez
  • 941
  • 8
  • 15