Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host key verification failed. #13

Open
fniko opened this issue May 24, 2020 · 1 comment
Open

Host key verification failed. #13

fniko opened this issue May 24, 2020 · 1 comment

Comments

@fniko
Copy link

fniko commented May 24, 2020

Hi, I am having issues with Docker version of your app using OAuth2
bbbackup.cfg

[authorization]
; enter which auth method to use 'oauth' or 'uidpwd'
auth_method = oauth

[bitbucket_oauth]
; enter oauth 2.0 credentials here
key_or_id = /*OAuth consumers - key*/
secret = /*OAuth consumers - secret*/
app_name = /*OAuth consumers - app name*/

The app is able to read the repositories, but every single one is failing with error:

RETRYING: Try #4 of 3 to clone repo.
REPO SYNC: /clonedbackups/BACKUP_20200524_UTC/repo-name
REPO FAIL: /clonedbackups/BACKUP_20200524_UTC/repo-name
Unable to clone repo repo-name. Exception: Cmd('git') failed due to: exit code(128)
  cmdline: git clone --no-single-branch -v [email protected]:team-name/repo-name.git /clonedbackups/BACKUP_20200524_UTC/repo-name
  stderr: 'Cloning into '/clonedbackups/BACKUP_20200524_UTC/repo-name'...
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
'

OAuth Customer settings:
image

I understand the error, I could solve this adding public SSH certificate into ~./ssh/known-hosts, however, since this is Docker I should amend the Dockerfile to copy the certificate there every time, but I do not think this is the right approach.

Maybe the only thing which is not clear is Callback URL, what should I put here?

How to solve this?

@sergiop
Copy link

sergiop commented Sep 2, 2020

Hi @fniko I have the same issue.

Accordingly with this official article, to clone a Bitbucket repo with an access token you should use this command:

$ git clone https://x-token-auth:{access_token}@bitbucket.org/user/repo.git

If you change this:

REMOTE_REPO_PATH = '[email protected]:{}/{}.git'.format( CONFIG_TEAM, repo_slug)

with this*:

REMOTE_REPO_PATH = 'https://x-token-auth:' + oauth_token + '@bitbucket.org/{}/{}.git'.format( CONFIG_TEAM, repo_slug)

at line 1247 of bbbackup.py file, it works without the need of adding the public SSH certificate into ~./ssh/known-hosts.

Do you have any clue @or-staedtler?


(*) You need to set the oauth_token var just before the for statement (line 1219) with:

oauth_token = bitbucket_api_oauth2_token()

@fniko fniko closed this as completed Feb 8, 2023
@fniko fniko reopened this Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants