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: tracking changes in any set of files, 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

Important

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

Let's see how to stablish 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 keys with:

mkdir -p ~/.ssh
cd ~/.ssh
#create id_dropbear if none
( dropbearkey -y -f id_dropbear 2>/dev/null || dropbearkey -t rsa -f id_dropbear ) | grep "^ssh-rsa " > id_dropbear.pub

Important

The dbclient Dropbear ssh client uses ~/.ssh/id_dropbear as default private key.

Note

Only private keys in dropbear format are allowed. In case to 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 a 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.