AutomationFlowsDevOps › Push and Update Files in GitHub

Push and Update Files in GitHub

Push And Update Files In Github. Uses manualTrigger, stickyNote, github, executeCommand. Event-driven trigger; 13 nodes.

Event trigger★★★★☆ complexity13 nodesGitHubExecute CommandGit
DevOps Trigger: Event Nodes: 13 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "nodes": [
    {
      "id": "b3f0b4a9-34ea-4630-8756-eb43f8ecb4ff",
      "name": "When clicking \"Execute Workflow\"",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        220,
        640
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f5cb92f3-c3df-4640-90c1-870c9f27d085",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        830,
        402
      ],
      "parameters": {
        "width": 865.0290253216738,
        "height": 244.559082047148,
        "content": "## Push a single file via GitHub node directly to the remote GitHub repo"
      },
      "typeVersion": 1
    },
    {
      "id": "54f7a07c-8d85-4c69-81c9-a95449958eb4",
      "name": "GitHub push edited file",
      "type": "n8n-nodes-base.github",
      "position": [
        1200,
        480
      ],
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "list",
          "value": "teds-tech-talks",
          "cachedResultUrl": "https://github.com/teds-tech-talks",
          "cachedResultName": "teds-tech-talks"
        },
        "filePath": "README.md",
        "resource": "file",
        "operation": "edit",
        "repository": {
          "__rl": true,
          "mode": "list",
          "value": "git_push_article",
          "cachedResultUrl": "https://github.com/teds-tech-talks/git_push_article",
          "cachedResultName": "git_push_article"
        },
        "fileContent": "={{ $json.data }}\n## Updated at:\n{{ $now.toISO() }}",
        "commitMessage": "updated from n8n via GitHub node",
        "authentication": "oAuth2"
      },
      "credentials": {
        "githubOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2b625156-17a5-4245-9ee8-604a631d65fe",
      "name": "Update README and add new file",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        1040,
        800
      ],
      "parameters": {
        "command": "=echo '' >> {{ $('config').item.json.localrepo }}/README.md\necho '## Updated at:' >> {{ $('config').item.json.localrepo }}/README.md\necho '{{ $now.toISO() }}' >> {{ $('config').item.json.localrepo }}/README.md\necho 'Check new file' >> {{ $('config').item.json.localrepo }}/README.md\necho '' >> {{ $('config').item.json.localrepo }}/README.md\n\necho '# This is a new file' >> {{ $('config').item.json.localrepo }}/new_{{ $now.toFormat('yyyyddMM-hhmmss') }}.md"
      },
      "typeVersion": 1
    },
    {
      "id": "99bf3b00-7e51-49b6-a602-8769012d9270",
      "name": "Add files",
      "type": "n8n-nodes-base.git",
      "position": [
        1200,
        800
      ],
      "parameters": {
        "operation": "add",
        "pathsToAdd": ".",
        "repositoryPath": "={{ $('config').item.json.localrepo }}"
      },
      "typeVersion": 1
    },
    {
      "id": "f0e220c5-d717-471f-8b0c-cca3a06ff7f6",
      "name": "Commit",
      "type": "n8n-nodes-base.git",
      "position": [
        1360,
        800
      ],
      "parameters": {
        "message": "updated from n8n via Git node",
        "options": {},
        "operation": "commit",
        "repositoryPath": "={{ $('config').item.json.localrepo }}"
      },
      "typeVersion": 1
    },
    {
      "id": "7ef8674e-3c1f-4903-aa3e-28af69d80264",
      "name": "Push",
      "type": "n8n-nodes-base.git",
      "position": [
        1520,
        800
      ],
      "parameters": {
        "options": {
          "targetRepository": "https://github.com/teds-tech-talks/git_push_article.git"
        },
        "operation": "push",
        "authentication": "gitPassword",
        "repositoryPath": "={{ $('config').item.json.localrepo }}"
      },
      "credentials": {
        "gitPassword": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f27bb600-4352-47db-aeeb-7688fa6c72c1",
      "name": "config",
      "type": "n8n-nodes-base.set",
      "position": [
        520,
        640
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "localrepo",
              "value": "/path/to/git/repo"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "512f0333-358d-43e6-a03f-b13792969d04",
      "name": "Pull",
      "type": "n8n-nodes-base.git",
      "position": [
        880,
        800
      ],
      "parameters": {
        "operation": "pull",
        "repositoryPath": "={{ $('config').item.json.localrepo }}"
      },
      "typeVersion": 1
    },
    {
      "id": "2830b321-5b58-4080-9a53-ddc703a80ec9",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        827.4395480225996,
        720
      ],
      "parameters": {
        "width": 870.5619913953059,
        "height": 251.5433184970501,
        "content": "## Push all changes via Git node"
      },
      "typeVersion": 1
    },
    {
      "id": "da8b52dd-4245-4adb-aff8-63f19a002d16",
      "name": "GitHub get file",
      "type": "n8n-nodes-base.github",
      "position": [
        880,
        480
      ],
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "list",
          "value": "teds-tech-talks",
          "cachedResultUrl": "https://github.com/teds-tech-talks",
          "cachedResultName": "teds-tech-talks"
        },
        "filePath": "README.md",
        "resource": "file",
        "operation": "get",
        "repository": {
          "__rl": true,
          "mode": "list",
          "value": "git_push_article",
          "cachedResultUrl": "https://github.com/teds-tech-talks/git_push_article",
          "cachedResultName": "git_push_article"
        },
        "authentication": "oAuth2",
        "additionalParameters": {}
      },
      "credentials": {
        "githubOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e4eb2f71-5b66-4ab7-bb1a-b48ef25728e1",
      "name": "Decode file",
      "type": "n8n-nodes-base.code",
      "position": [
        1040,
        480
      ],
      "parameters": {
        "jsCode": "var text = Buffer.from($input.first().binary.data.data, 'base64').toString('utf8');\nreturn {\"data\": text};"
      },
      "typeVersion": 2
    },
    {
      "id": "ec27d375-b994-415c-be53-5715df83585c",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400.9808509052974,
        440
      ],
      "parameters": {
        "width": 373.9894195663518,
        "height": 383.3156992772523,
        "content": "## Please update the path to the local repository and connect this node to the upper or lower parts of the workflow"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Pull": {
      "main": [
        [
          {
            "node": "Update README and add new file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Commit": {
      "main": [
        [
          {
            "node": "Push",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add files": {
      "main": [
        [
          {
            "node": "Commit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Decode file": {
      "main": [
        [
          {
            "node": "GitHub push edited file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GitHub get file": {
      "main": [
        [
          {
            "node": "Decode file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update README and add new file": {
      "main": [
        [
          {
            "node": "Add files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \"Execute Workflow\"": {
      "main": [
        [
          {
            "node": "config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

How this works

This workflow streamlines the process of updating and pushing files to your GitHub repository, saving you time on manual version control tasks and ensuring your project stays current without tedious command-line interactions. It's ideal for developers, content creators, or teams managing codebases or documentation who need a reliable way to automate file modifications directly from n8n. The key step involves using the GitHub node to edit files, followed by executeCommand to update content like READMEs, and then committing and pushing changes via Git integration for seamless deployment.

Use this workflow when you have recurring file updates triggered by events, such as after editing documentation or scripts, to maintain an organised repository without switching tools. Avoid it for complex branching strategies or large-scale migrations, where dedicated CI/CD pipelines like GitHub Actions offer more robustness. Common variations include adding email notifications post-push or integrating with tools like Slack for team alerts on successful commits.

About this workflow

Push And Update Files In Github. Uses manualTrigger, stickyNote, github, executeCommand. Event-driven trigger; 13 nodes.

Source: https://github.com/Zie619/n8n-workflows — original creator credit. Request a take-down →

More DevOps workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

DevOps

This workflow performs various Git operations. It starts with a manual trigger, sets the local repository path, decodes a file and then updates a file's content, adds, commits, and pushes changes to a

GitHub, Execute Command, Git
DevOps

Code Github. Uses manualTrigger, stickyNote, httpRequest, noOp. Event-driven trigger; 24 nodes.

HTTP Request, GitHub, Execute Command +1
DevOps

Bn1. Uses executeCommand, github. Event-driven trigger; 5 nodes.

Execute Command, GitHub
DevOps

This template lets you selectively import n8n workflows from a GitHub repository, even when your repository uses deeply nested folder structures.

Form Trigger, GitHub, n8n +1
DevOps

Code Github. Uses manualTrigger, stickyNote, n8n, httpRequest. Event-driven trigger; 25 nodes.

n8n, HTTP Request, GitHub +1