Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,466,078
Community Members
 
Community Events
176
Community Groups

GIT clone could not read from remote repository error in Bitbucket pipeline on self-hosted Runner

Hi,

I have a pipeline returning the following error. The pipeline runs on a self-hosted runner (Docker container) on Redhat instance.

 

[RuntimeException]
Failed to execute git clone --mirror -- 'git@bitbucket.org:company_work/repo_name.git' '/root/.composer/cache/vcs/git-bitbucket.org-company-work-repo-name.git/'
Cloning into bare repository '/root/.composer/cache/vcs/git-bitbucket.org-company-work-repo-name.git'...
ssh: connect to host bitbucket.org port 22: Cannot assign requested address
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

I have configured SSH keys as described in this thread

Also, is there a way to output more detailed logging when a pipeline runs? Is there any way to tell which container the pipeline is being executed? 

 

1 answer

0 votes

Hi @ForeverBaffled and welcome to the community.

If the server you are using is behind a firewall, please make sure to whitelist the following IP ranges:

I've seen this error occur mainly because of firewall rules blocking the connections to bitbucket.org

is there a way to output more detailed logging when a pipeline runs?

What kind of additional logging are you looking for? If you would like verbose output from the clone command, you can add the following arguments in the clone command in your yml file:

GIT_TRACE_PACKET=1 GIT_TRACE=1 GIT_SSH_COMMAND="ssh -vvv" git clone <repo URlL>

Is there any way to tell which container the pipeline is being executed?

For every step of your build, a separate Docker container starts based on the image you have defined in your bitbucket-pipelines.yml file. If you haven't defined an image in the yml file, then the DockerHub image atlassian/default-image:latest will be used by default. While the step is running, you can run docker ps and if the step's build container has started, you should see it listed and identify it by the image name (if no other containers based on this image are running). Please keep in mind that each step's build container gets destroyed once the step finishes.

Kind regards,
Theodora

Thanks for the info @Theodora Boudale . After adding the arguments to the git clone command, I'm seeing the following after generating a key and adding my public key to Bitbucket > Repo > Security > Access Keys. Is this still a firewall on our side? 

OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d 10 Sep 2019
debug1: Reading configuration data /root/.ssh/config
debug1: /root/.ssh/config line 1: Applying options for bitbucket.org
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "bitbucket.org" port 22
debug2: ssh_connect_direct
debug1: Connecting to bitbucket.org [104.192.141.1] port 22.
debug1: connect to address 104.192.141.1 port 22: Connection refused
debug1: Connecting to bitbucket.org [2406:da00:ff00::22c5:2ef4] port 22.

Also, we have other pipelines successfully completing on these self-hosted runners (containers). The difference here is that the pipeline clones another repo. 

I should add that if I git clone using https and use a personal app password, the cloning is successful.

Hi @ForeverBaffled,

Thank you for the info.

The following error points to a network-related issue:

debug1: connect to address 104.192.141.1 port 22: Connection refused

The client hasn't reached the point where it offers the private SSH key for authentication, the operation fails before that, while it tries to establish a connection to Bitbucket. After that line, I also see an attempt to connect via IPv6:

debug1: Connecting to bitbucket.org [2406:da00:ff00::22c5:2ef4] port 22.

Is there a 'Connection refused' error after that as well?

If using HTTPS is successful, then the issue may be specific to SSH. Perhaps port 22 is blocked? HTTPS and SSH use different ports, and when you run a pipelines runner build the clone that happens in 'Build Setup' uses HTTPS as well.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events