Currently Viewing Posts Tagged remote

How to Link Remote Repositories to Node Red Projects

adding ssh key in node red

Following the Node Red Project Guide allows you to backup your flows in git projects. This is a great feature for adding revision control to your projects. In this article, I will expand on the project guide and show you how to set up link your projects to a remote repository.

Remote Repositories

First, this article assumes that you have an account on a git revision control system (i.e., github or gitlab). Next, it assumes you know how to create projects and add SSH keys to your account profile.

Start by creating an empty project in your git revision control system. Next locate the ssh url for your newly created project.

git@xxxurlxxx.com:my-node-red-project.git

Now, in the Node Red, select the Hamburger icon on the upper right and then select Project->Project Settings. Once again select the Project tab.

Click on the “add remote” button and add the ssh url for your project. Confirm that the url now appears in the Git remotes list.

Generating SSH Keys

The next step is to generate a SSH keys and adding the public key to your git revision control system account.

Once again, in Node Red, select the hamburger icon and then select the “Settings” menu item. Then, select the “Git config” tab.

Now let’s click on “add key”.

Give your key a friendly name and then click Generate key and a public key will be generated.

Copy the public key and then add it to your git revision control system account. Make sure to keep it secret. Don’t worry about me, I only generated this key as an example :).

Pushing Changes to Your Remote Repository

One area I find lacking in the user interface is the ability to Push or Pull changes from a remote repository. Currently the only available is to manually push or pull from the command line.

Projects are stored in your Node Red configuration directory under the ./project folder.

Open a terminal and navigate to the directory. Issue the following command to link the local git project to the remote repository and upload the project.

git push --set-upstream origin master

This should push all the changes from the local project to the remote repository.

Going forward you can utilize the Node Red user interface to commit changes to the local repository. However when you want to push or pull changes from the remote repository, you will need to use the command line.

Conclusion

This post showed you how to set up a remote repository and push / pull project changes. It would be great if the developers could add this feature directly to the Node Red user interface. If you’re in agreement, let the developers know.