"Git is not initialized" - Error of connecting n8n instance with a repository for setting up Source control and environments

Hi everyone,

Thank you as always. I’m truly grateful for n8n. It’s such an amazing platform and has been incredibly helpful for my work.

I’ve run into an issue and would really appreciate your help.

I recently subscribed to the Startup Plan and am now trying to set up n8n using self-hosting. Following the steps in the tutorial (*1) to create a new repository and connect it to my n8n instance, I encountered a problem.

When I go to Settings > Environments in n8n and select Connect, I get a 400 error on the request to POST https://{base url}/rest/source-control/preferences, and an error message saying "Error connecting to Git - Git is not initialized” (see attached screenshot). I’m unable to link the repository.

Has anyone experienced this issue or know what might be causing it?

Thanks in advance for your support!

(*1) Tutorial: Create environments with source control

We are having the same issue

Hi, @bironeaj

We were able to identify the root cause of the issue and find a workaround, so we’d like to share it in case it’s helpful to you!

We were using Azure App Service as our runtime environment. However, when running the n8n container on App Service, the user and group inside the container were set to nobody:nogroup (due to Azure’s specifications), instead of node:node. This caused authentication errors with Git.

The reason is that n8n internally uses the simple-git library, which accesses the file system directly.

To resolve this, we switched from using App Service to running the container inside a VM, which avoided the issue.
I hope this can be even a small help in solving your issue.

Hiro

1 Like

This is a real bummer. We will look into trying out AKS. Thank you for the info!