# Github automation

**URL:** <https://discourse.nodered.org/t/github-automation/42392>\
**Category:** General\
**Created:** [10 March 2021 09:00 UTC](https://discourse.nodered.org/t/github-automation/42392 "2021-03-10T09:00:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![CuriousUser](https://avatars.discourse-cdn.com/v4/letter/c/4af34b/32.png) [@CuriousUser](https://discourse.nodered.org/u/CuriousUser)\
**Post date:** [10 March 2021 09:00 UTC](https://discourse.nodered.org/t/github-automation/42392/1 "2021-03-10T09:00:25Z")

</div>

Hello,

I know there is a "Projects" feature in Node-Red for linking and cloning repositories from Github. My question is: Is it possible to automate cloning process via standard commands used in terminal to do those operations and can I just use it on directory craeted by node-red projects feature?

My goal is to have "one button" solution Where I just call out scripts on machines and they will clone/deploy changed node-red code from respository. So I don't have to do it manually via Node-red Editor.

Thank you for your time and answers!

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [10 March 2021 14:28 UTC](https://discourse.nodered.org/t/github-automation/42392/2 "2021-03-10T14:28:23Z")

</div>

I don't personally use the project feature. But I seem to remember that @knolleary has previously said that you should not try to mess with the project other than via the internal Node-RED controls? You might try searching for previous threads on the forum.

In theory you could issue git commands easily enough using an exec node but what impact that might have on a project I wouldn't like to guess.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [10 March 2021 14:50 UTC](https://discourse.nodered.org/t/github-automation/42392/3 "2021-03-10T14:50:06Z")

</div>

That's only the case on the instance you're actively editing and developing the flow on.

Remotely deploying the git repo and using it as a way to distributing updates to other devices is a perfect use of projects.

There are a few different ways of approaching it. Can't elaborate right now, but will reply later (ping me if I've clearly forgotten to get back to you).

---

<div class="post-metadata">

**Author:** ![CuriousUser](https://avatars.discourse-cdn.com/v4/letter/c/4af34b/32.png) [@CuriousUser](https://discourse.nodered.org/u/CuriousUser)\
**Post date:** [15 March 2021 06:17 UTC](https://discourse.nodered.org/t/github-automation/42392/4 "2021-03-15T06:17:38Z")

</div>

ping 🙂

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [15 March 2021 10:11 UTC](https://discourse.nodered.org/t/github-automation/42392/5 "2021-03-15T10:11:43Z")

</div>

Thanks for the ping 🙂

It depends how you want to work with the 'remote' instances.

If you don't plan to use the editor on the remote instances directly, then you can run those as 'headless' instances - without the projects feature enabled and with the editor disabled.

You can then develop the flows on your local instance using a Project, and by adding a settings.js file and a couple updates to the its package.json file, the repo can then easily be deployed and run.

I wrote a blog post a while ago that outlines the basic principle - although in that instance it talks about deploying to a cloud environment which isn't so relevant here: [Creating a Node-RED deployment pipeline to IBM Cloud · knolleary](https://knolleary.net/2018/06/01/creating-a-node-red-deployment-pipeline-to-ibm-cloud/)

If you follow what that post says for the settings and package files, on a remote machine you can then do:

```auto
git clone <your-project-repo>
cd <project-directory>
npm install
npm start

```

to run the code.

If you already have Node-RED installed and setup to run automatically on those devices then you won't need to add `node-red` as a dependency to the package.json and you won't need the `start` command. You will have to make sure that your node-red instance picks up the settings and flows file from your project directory. So to update the flows, you'd run `git pull` to get the latest changes and then restart Node-RED.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [14 May 2021 10:12 UTC](https://discourse.nodered.org/t/github-automation/42392/6 "2021-05-14T10:12:21Z")

</div>

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