Skip to content

Git and Dropbear SSH Client

New in image release 22.10.

Git is free and open source software for distributed version control. It aims to track changes in any set of files, and usually used for coordinating work among programmers collaboratively developing source code during software development.

Node-RED projects use Git under the hood which endows the Node-RED editor with essential version control tools.

This section is devoted to those users wanting to use SSH connections for Git-repositories/Node-RED-projects in the eManager.

Usage

The opkg utility installs the official git command-line utility. See this link for the official documentation.

Installation

Git can be installed with the opkg utility. To do so, enter:

opkg update
opkg install git
in the eManager terminal with Internet connection.

Authenticating remote repository with SSH

The eManager ships without OpenSSH suite, the lightweight Dropbear SSH suite is used instead.

Let's see how to establish an ssh connection with GitHub using Dropbear utils.

1. Create your first SSH keys

dropbearkey utility creates private keys encoded in a particular dropbear format for the use with Dropbear or dbclient.

Create a key named id_dropbear with:

new_ssh_id="id_dropbear"
mkdir -p ~/.ssh
cd ~/.ssh
( dropbearkey -y -f $new_ssh_id 2>/dev/null || dropbearkey -t rsa -f $new_ssh_id) | grep "^ssh-rsa " > $new_ssh_id.pub

The new key consists of two files id_dropbear and id_dropbear.pub placed in ~/.ssh/ folder.

Execute:

ls ~/.ssh/ 
to verify that both files have been created properly.

Multiple SSH keys

The dbclient ssh client uses the key in ~/.ssh/id_dropbear as default private key. Nevertheless, multiple ssh keys can be handled. In order to generate extra keys execute the block above replacing the name "id_dropbear" in the first line with a new name. This will generate a secondary pair of ssh keys named as desired.

Note

Only private keys in dropbear format are allowed. If you want to use an external SSH key generator consider using dropbearconvert to convert between Dropbear and OpenSSH private key formats.

2. Authentify in GitHub

Type the following in an eManager terminal:

cat ~/.ssh/id_dropbear.pub
and copy the output to the clipboard.

Open your GitHub account in your PC, go to Settings, look for the SSH and GPG keys section and press New SSH key. Choose a title for your key, paste the key and click Add SSH key.

3. Add GitHub to trusted hosts

Open an eManager terminal with Internet, type:

ssh git@github.com

and answer y to the question.

GitHub should answer through the eManager terminal with a successful authentication message:

Hi USER! You've successfully authenticated, but GitHub does not provide shell access.

Now, every git ssh connection should use your new SSH credentials.

4. Switching remote URLs from HTTPS to SSH

In order to use your brand new SSH credentials in a Node-RED projects repository we must modify the remote URL of that project, in our example it's called pickdata.

In the eManager terminal navigate to the projects directory:

cd /var/lib/node-red/projects
The ls command will list all the available Node-RED projects in your eManager.

Navigate to the desired project:

cd pickdata

Switch remote URLs from HTTPS to SSH. From now on the pickdata Node-RED project should access the remote repository using SSH.