bitrise-steplib / steps-git-clone

MIT License
16 stars 47 forks source link

The step should fail if there is no access to the repo #159

Closed allco closed 3 years ago

allco commented 3 years ago

Troubleshooting

Issue description

This πŸ‘‡

$ git "remote" "add" "origin" "git@bitbucket.org:XXXXXXXXXXXXXXXXXXXXXXXXX"
Diff file unavailable: unable to download file from: https://app.bitrise.io/build/cf5e370a4a4aaf25/diff.txt?api_token=[REDACTED]. Status code: 400
May fail due to missing authentication as Pull Request opened from a private fork.
A git hosting provider head branch or a diff file is unavailable.

....

$ git "fetch" "--jobs=10" "--no-tags" "fork" "refs/heads/prxxxx_issue_test_branch"
Forbidden
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Attempt 1 failed:
Forbidden
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Retrying...
$ git "fetch" "--jobs=10" "--no-tags" "fork" "refs/heads/prxxxx_issue_test_branch"
Forbidden
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Attempt 2 failed:
Forbidden
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Retrying...
$ git "fetch" "--jobs=10" "--no-tags" "fork" "refs/heads/prxxxx_issue_test_branch"
Forbidden
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Attempt 3 failed:
Forbidden
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

should lead the entire task to fail

Currently the task succeeds even if it is not able to actually connect to the remote repo.

Bitrise info

Roland-Bak commented 3 years ago

Hello there @allco πŸ‘‹ Can you please send us the log file or the URL of the related build and also enable Support Access on the Settings tab of the app ( https://devcenter.bitrise.io/troubleshooting/enabling-bitrise-support-user/ ) so that we can take a more in-depth look?

I'd be happy to forward this to the developers to see what they can come up with πŸ™‚

allco commented 3 years ago

Hej Roland-Bak,

Here you are: https://app.bitrise.io/build/101b889157951d0a#?tab=log

muzammil-hussain commented 3 years ago

You an find logs in attached file 101b889157951d0a.log

Roland-Bak commented 3 years ago

Hey there πŸ‘‹

I think the main part of the issue is:

repository access denied.
fatal: Could not read from remote repository.

Could you please make sure you have the correct access rights and that the repository exists? This means that the SSH key registered for your app on Bitrise does not have access to or is not allowed to access the repository.

Make sure that the SSH key (which you can find on the app’s Settings tab on Bitrise) is registered on your source code hosting service.

Here is a guide for this: http://devcenter.bitrise.io/adding-a-new-app/setting-up-ssh-keys/#manual-setup

In case you have submodules too, check out this guide which explains how you can grant access to all the relevant repos for Bitrise: http://devcenter.bitrise.io/faq/adding-projects-with-submodules/ πŸ™‚

allco commented 3 years ago

Hey @Roland-Bak, Thank you for answer. I know that we had issues with accessing the repository. The main problem why this issue was created is that the steps-git-clone should fail if it is not able to do its job by any reason. I my case the repo was not accessible and steps-git-clone reported success when it is finished but in reality steps-git-clone actually failed to do it's job.