Connect Node-RED Project to Bitbucket git [SOLVED]

A short how-to (for the next time I need it...)

When I tried to connect my project git to a Bitbucket repository, I couldn't get it right. Now I have, so let's share it. In the end, I had the entire project already in Bitbucket, and managed to clone it to Node-RED.

In preparation, I have entered my Git config (under Settings) and generated an SSH key with a passphrase. The public key ends with == and my e-mail address. This public key was added to my account in Bitbucket. (Earlier I tried adding the key to the repository, that didn't work.)

The video "Introduction to Node-RED Projects" (Introduction to Node-RED Projects - YouTube) shows at 10:38 the cloning of an existing git.
The trick was to get a url starting with git@ like the video shows. When I clicked Clone in Bitbucket, I got an HTTPS url by default. Choose SSH there.

CloneRepository

This also brings up the possibility to choose the SSH key.

Hi there!
In search of a more elaborate procedure with much more details I am wondering how you did the following (yes, I did read the docu for project and related SSH keys etc. No, I did not understand all of it as I have unfortunately not an IT security background. So please forgive if my questions sound silly.)

  1. What was you starting point in git? repo on bitbucket was up to date or in node-red? I am looking for a howto when the project in node-red is the last current one. (I thought my setup was working, but it stopped doing now.)
    I am willing to copy all changes to bitbucket manually if bitbucket being up to date should be the starting point. Thugh I am not yet sure which files I would have to copy appart from the flows_projectname.json file

  2. How did you configure/install the credentials in bitbucket? Which file goes where? For example I see in my node-red commit that the flows_projectname_cred.json file got updated and comitted and seems to be part of the git repo. How is this handled properly?

  3. How does the new bickbucket login for Applications work together with node-red? Do I need to use one of the application specific passphrases? Does that go to the user/pwd that node-red asks me when trying to push/pull?

  4. How can I setup tracking of working trees? node-red keeps telling me that there is no remote configured, even though I used to push/pull happily to bitbucket!?

Thanks a lot for your input!
Cheers
JR

Hi JR,

I'm not sure whether I can help you out: I was glad I could set up my own connection with Bitbucket.
The git definition will determine what is being synced. In my project three json files are uploaded: flows, _cred and package.

Let's start with the SSH key. Did you make one? Did you register the public key at the Bitbucket side?

I tried to recreate the steps I did and cannot find anymore the description on how to setup the SSH keys.

The points I am missing are:

  • where in the node-red project can I add the SSH key? Also I thought I read a description on how to create the key, but that seems to be gone from the node-red docu (nodered.org/docs/user-guide/projects/)
    edit: just found the spot in the node-red menu. It is at: menu > settings > Git config
  • where on bitbucket do I store the SSH key? The so called "access keys" on bitbuckt allow only "read-only" access, which is not what I need. I need "read+write" in order to be able to push as well. On which level (account, project, repo) on bitbucket can and must I add the SSH key?

Thanks for your input!

Yes, indeed!

In Bitbucket, click your initials in the upper right corner, then Personal settings. Then SSH Keys, and then Add.

Good luck!

1 Like

That did it!
Thank you so much!

Following that I had to add bitbucket to the known hosts file using:
ssh-keyscan -t rsa bitbucket.org >> ~/.ssh/known_hosts

The passphrase to the generated SSH key is then requested by node-red as "login" info when pushing/pulling

After that I could create branches, push commits etc.
For those wondering about the bitbucket App Passwords - they are not needed when using SSH keys.

Thanks a lot!
JR

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