Issue with GIT repository using ssh-keys

Hi,
I'm stuck integrating a GIT repository using ssh-keys.
I have the NodeRed 1.1.3 (latest now) and a gitea Installation 1.12.4 (latest now)

When I try to clone a repo from the GIT server it failes.
I'm using the GIT URL git@hostname.fqdn:gitrepo/test.git

Log from Node-Red (trace):

18 Sep 11:28:20 - [trace] runGitCommandWithSSHCommand {"key_path":"/home/wf/.node-red/projects/.sshkeys/admin_zui","passphrase":""}
18 Sep 11:28:20 - [trace] git["clone","ssh://git@hostname.fqdn:gitrepo/test.git","."]
18 Sep 11:28:20 - [debug] git -c credential.helper= clone ssh://git@hostname.fqdn:gitrepo/test.git .
18 Sep 11:28:20 - [debug] [err] Cloning into '.'...
18 Sep 11:28:20 - [debug] [err] LDAP Login enabled
18 Sep 11:28:20 - [debug] [err] Gitea: Invalid repository path
18 Sep 11:28:20 - [debug] [err] Invalid repository path: 'test.git'
18 Sep 11:28:20 - [debug] [err] fatal: Could not read from remote repository.
18 Sep 11:28:20 - [debug] [err]
18 Sep 11:28:20 - [debug] [err] Please make sure you have the correct access rights
18 Sep 11:28:20 - [debug] [err] and the repository exists.
18 Sep 11:28:20 - [debug] rc=128

When I try to do the same manually it works

vim /home/wf/.ssh/config
#Add the 2 lines:
---
Host hostname.fqdn
    IdentityFile /home/wf/.node-red/projects/.sshkeys/admin_zui
---

wf@hostname:/tmp/j$ git clone git@hostname.fqdn:repo/test.git
Cloning into 'test'...
LDAP Login enabled
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), 238 bytes | 0 bytes/s, done.
Checking connectivity... done.

Do you have any idear what goes wrong or how to generate more debug data?
The following line seems a little strange, but I'm not sure.
git -c credential.helper= clone ssh://git@hostname.fqdn:gitrepo/test.git .

Thanks for any hint

Try without the ssh:// at the start of the git url when you enter it in the ui.

Thanks, but I tried that already,without any success/difference.

I can see the following log-messages in /var/log/auth.log. It seems that node-red doesn't correctly try to use key based authentication, but instead user/password.


Sep 18 13:34:40 hostname  sshd[13677]: Failed password for git from 192.168.1.11 port 56653 ssh2
Sep 18 13:34:40 hostname  sshd[13677]: Failed password for git from 192.168.1.11 port 56653 ssh2
Sep 18 13:34:40 hostname  sshd[13677]: Connection closed by 192.168.1.11 [preauth]

@knolleary: Nick, can you tell me which git commands NodeRed launches? Even with all debugging enabled I can't find a reason why its failing...
I would be very happy for any support :slight_smile:

You can see the git commands it runs in the log -

18 Sep 11:28:20 - [trace] git["clone","ssh://git@hostname.fqdn:gitrepo/test.git","."]
18 Sep 11:28:20 - [debug] git -c credential.helper= clone ssh://git@hostname.fqdn:gitrepo/test.git .

@knolleary: Thank you :slight_smile: I'm totally lost to debug this issue.

So I'm able to authenticate using ssh-key with git by explicitly setting my project-key as key in ~/.ssh/config, otherwise it fails.
The question is: How does this credential.helper thing work in node-red (Actually: How does node-red pass the pub-key to git).
Is it possible. that for node-red uses the environment Variable ```
GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa_example"

to pass the key? Actually I'm using git < 2.3.0 and this variable is supported with git >= 2.3.0

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