# Authentication with GIT

**URL:** <https://discourse.nodered.org/t/authentication-with-git/70454>\
**Category:** General\
**Created:** [11 November 2022 14:35 UTC](https://discourse.nodered.org/t/authentication-with-git/70454 "2022-11-11T14:35:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pinky](https://avatars.discourse-cdn.com/v4/letter/p/3d9bf3/32.png) [@Pinky](https://discourse.nodered.org/u/Pinky)\
**Post date:** [11 November 2022 14:35 UTC](https://discourse.nodered.org/t/authentication-with-git/70454/1 "2022-11-11T14:35:45Z")

</div>

Hello everybody,

I found alot of topics like this but still can't figure out where my exact Problem is.  
I already had git set up and running fine but for a while now pushing to my repo is not possible anymore. The Credentials window pops up, I enter my credentials and it comes up agian.

When looking up the response in the network-Tab I can see a 400 with this Message:

> {"code":"git\_auth\_failed","message":"remote: Login failed due to incorrect login credentials or method.\nremote: If you are unsure of which login details or login method to use, visit:\nremote: [https://support.atlassian.com/bitbucket-cloud/docs/log-into-or-connect-to-bitbucket-cloud/\nfatal:](https://support.atlassian.com/bitbucket-cloud/docs/log-into-or-connect-to-bitbucket-cloud/%5Cnfatal:) Authentication failed for '[https://bitbucket.org/myUsername/node-red.git/](https://bitbucket.org/myUsername/node-red.git/)'\n"}

So I went to the page that is mentioned and logged in. With the exact same credentials I entered in node-red. Works fine.

I am using bitbucket and entered an ssh-key to my account. The same key is also registered within node-red. (Settings-\>Git-Config-\>SSH-Keys

I have no clue what I am doing wrong. Any hints?

Best regards,  
Pinky

---

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [12 November 2022 11:53 UTC](https://discourse.nodered.org/t/authentication-with-git/70454/2 "2022-11-12T11:53:06Z")

</div>

For me it is working with a token. The github password doesn't work. But, if you create a token on github, it does...  
On github, when authenticated, go to settings -\> Developper settings (last in the menu on the left). Create a token. Use it 🙂

---

<div class="post-metadata">

**Author:** ![Pinky](https://avatars.discourse-cdn.com/v4/letter/p/3d9bf3/32.png) [@Pinky](https://discourse.nodered.org/u/Pinky)\
**Post date:** [12 November 2022 17:47 UTC](https://discourse.nodered.org/t/authentication-with-git/70454/3 "2022-11-12T17:47:29Z")

</div>

Unfortunatelly I am using bitbucket - and Bitbucket does not support Tokens.

Okay, after digging deeper into the whole thing I connected to the console and fired git from there. Got the same error. So I setup rsa-key verification for the repo and now I was able to push/pull from the console. (Also changed the url of the repo from https to ssh.)

Pushing and pulling from the console works fine now. But I still receive an error message in node-red.  
It says:

"Der Repository Host-Schlüssel konnte nicht verifiziert werden. Bitte aktualisieren Sie Ihre `known_hosts` -Datei und versuchen Sie es erneut."

-\> Host key verification can not be done. As I do not receive this error message on the console I think it has something to do with the executing user. Any hints how to solve that?

---

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [13 November 2022 10:47 UTC](https://discourse.nodered.org/t/authentication-with-git/70454/4 "2022-11-13T10:47:06Z")

</div>

> [@Pinky](#):
>
> Any hints how to solve that?

I guess it depends how you have deployed NodeRed. If you have created a specific user or if you run in docker the ssh keys won't be the same as the ones in the console.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [13 November 2022 10:56 UTC](https://discourse.nodered.org/t/authentication-with-git/70454/5 "2022-11-13T10:56:52Z")

</div>

[Perhaps this](https://stackoverflow.com/a/40578618) clears it up. The ssh key needs to exist in the known\_hosts file.

---

<div class="post-metadata">

**Author:** ![Pinky](https://avatars.discourse-cdn.com/v4/letter/p/3d9bf3/32.png) [@Pinky](https://discourse.nodered.org/u/Pinky)\
**Post date:** [14 November 2022 17:32 UTC](https://discourse.nodered.org/t/authentication-with-git/70454/6 "2022-11-14T17:32:49Z")

</div>

Yeah, that helped somehow.  
I already ssh-ed directly via console to [bitbucket.org](http://bitbucket.org) but that only inserted the key to the known\_hosts file of the user "pi".

su-ing to the User iobroker is not possible on my system. I already tried adding the key on that way too. What finally worked was: Searching all "known\_hosts" files on the System. The user iobroker has one in its home-directory. Root can edit it and adding the key from the link above solved the Problem.

sudo echo "..." does NOT add the key. (No permissions) (Dafuqq?)  
sudu su  
-\> cd /home/iobroker/.ssh  
-\> nano known\_hosts  
-\> insert key here

[bitbucket.org](http://bitbucket.org),104.192.143.1 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw==

Save and you are good to go.  
However, it feels like something went wrong in the process here. Shouldn't node-red be able to save the key on its own? Maybe ask if the user shall allow the key?

However - thanks guys!  
Working now.

Best regards

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 November 2022 17:33 UTC](https://discourse.nodered.org/t/authentication-with-git/70454/7 "2022-11-28T17:33:25Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
