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

error adding app: failed to clone application repo: failed cloning user repo: ssh://git@github.com/user/podinfo-deploy.git: ssh: handshake failed: knownhosts: key mismatch #1132

Closed
1 of 11 tasks
dev-wolfy opened this issue Nov 24, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@dev-wolfy
Copy link

dev-wolfy commented Nov 24, 2021

Error adding app: failed to clone application repo: failed cloning user repo: ssh://git@github.com/user/podinfo-deploy.git: ssh: handshake failed: knownhosts: key mismatch

I installed weave-gitops on an up to date K8s cluster.
After following the documentation with the example from the Getting started section https://docs.gitops.weave.works/docs/getting-started

After validating the authentication on github https://docs.gitops.weave.works/assets/images/github-device-flow-complete-f9a2e700c850d2f6c8dcfcff15db9988.png
I get the following error message : error adding app: failed to clone application repo: failed cloning user repo: ssh://git@github.com/wolfgit53/podinfo-deploy.git: ssh: handshake failed: knownhosts: key mismatch.

know that gitops is based on flux and after some research I found this issue on the github of flux2 : fluxcd/flux2#2097. The is the same problem, and the solution is to update the known_hosts in the flux-system secret with the ecdsa-sha2-nistp25 value:

github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=

I found the right secret in the wego namespace but I have the good value :

$ kubectl -n wego-system get secrets  wego-wolfy-k8s-podinfo-deploy -o json | jq '.data | map_values(@base64d)'

"known_hosts": "github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=

So is it a bug from the weaveworks gitops tool?

issue

What is the severity of the bug
severity/Minor

Label Description
severity/Major Weave Gitops functionality is broken, can't add any application

Environment

  • gitops: v0.4.1
  • kubernetes: v1.21.5
    • KinD
    • k3s
    • cloud [e.g., EKS, AKS]
    • other - RKE 1.3.1
  • Browser + version: 94.0

Affects versions
v0.4.1

To Reproduce
Steps to reproduce the behavior:

  1. Install latest version of gitops
  2. Click on Add Application
  3. Follow the getting started section of the documentation
  4. When github allow the device connection
  5. See error on the gitops's dashboard

Expected behavior
The possibility to add new applications without ssh errors

Config and Logs
If applicable, add logs to help explain your problem. please compress the output before attaching

  • gitops config
  • gitops cli call output (and parameters)
  • gitops-controller logs
  • Events from wego-* namespaces
  • kubectl cluster-info dump
  • Prometheus alerts
  • Flux logs

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Sorry for my English 😬

@dev-wolfy dev-wolfy added the bug Something isn't working label Nov 24, 2021
@palemtnrider
Copy link
Contributor

Thanks, @dev-wolfy for reporting this 👍 This was fixed in a subsequent release to the version you reported. Closing.

@LongBeachHXC
Copy link

Hey @palemtnrider I don't know if this was fixed...I'm seeing this behavior in 0.6.2. Could be user error here but I even created a new secret and used the files in my local .ssh directory to populate the values and I'm still getting ssh: handshake failed: knownhosts: key mismatch trying to clone the repo

Current Version: 0.6.2
GitCommit: 35945c8b13e8762d1b083c5e7e978bbbd0558cdc
BuildTime: 2022-01-25T22:01:28Z
Branch: HEAD
Flux Version: v0.24.1

@coryschwartz
Copy link

I'm also seeing this. Same version. 0.6.2.

@DanielRejniak
Copy link

DanielRejniak commented Mar 22, 2022

I also see the issue on version 0.6.2

...
◎ Checking cluster status
✔ GitOps installed
✚ Generating application spec manifest
✚ Generating GitOps automation manifest
✚ Generating GitOps source manifest
✚ Generating GitOps Kustomization manifest
Error: failed to add the app test-app: failed to clone repo: failed cloning user repo: ssh://git@github.com/***/***.git: ssh: handshake failed: knownhosts: key mismatch
...

[UPDATE]

I solved the problem following instructions here.

Quote :

The gitops CLI uses your local user's ~/.ssh/known_hosts file as the source for this key, and this error generally means that you need to remove the old RSA host key and add the new ECDSA host key in that file

In my case had to remove the old host key :

ssh-keygen -R github.com

@olivercp3
Copy link

generate new ECDSA host key doesn't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants