Create File in GitHub Repository

Has anybody managed to successfully create a binary file in a GitHub repository via the GitHub node?

When I try to create the file from Binary Data, I’m getting an error with the message ‘content is not valid Base64’.

When I try to create the file from Base64 (converted the binary via the Move Binary Data node), the file get created, but it’s text rather that the .png file.

Any suggestions on how to get this working is highly appreciated. Thanks in advance!

Hi @dickhoning, thanks so much for reporting this and please accept my apologies for the trouble this causes! I was able to reproduce the problem with the current version of n8n when using the Binary Data option and have added it to our backlog for a fix.

Chances are that when using base64 data your data arriving in GitHub is valid PNG data but that GitHub still considers it a text file as n8n doesn’t provide the right MIME type. I don’t have a great workaround for this at the moment apart from avoiding the n8n GitHub node. Using the HTTP Request node you could create a PNG file in a repository like so:

This works and the file shows up as an actual image when viewed on GitHub’s website:

1 Like

@MutedJam of course no problem, thanks in advance for having this fixed, and thanks for helping me to find a work-around. Unfortunately, I have not been able to get this working yet. Ik keep getting an error 404 …

You might want to change the response type on the HTTP Request node to JSON in order to view the error message from GitHub:

image

But I think the problem could be a missing /contents/ in your GitHub URL. My request went to https://api.github.com/repos/that-one-tom/n8n-gh-upload/contents/foo.jpg where that-one-tom is the owner, n8n-gh-upload the repository and foo.jpg is the file path.

So from looking at your screenshot you probably need to use a URL of https://api.github.com/repos/ecxs/budibase/contents/foo.jpg instead of your current URL.

1 Like

Thanks @MutedJam … now it works :slight_smile:

And can you please keep me posted on when this is fixed in the GitHub node? Or alternatively, let me know how/where I can keep an eye on this?

Thanks again and frohes Sylvester!

1 Like

Sure thing, glad to hear this works! We’ll automatically post in this thread once the bug is fixed (I am sure you’ve seen the posts from @jan that read “Got released with n8n@...”). I’ll unmark the solution here to prevent the the thread from closing automatically before this happens.

Have een fijn uiteinde as well!

Hey,

Was this ever fixed? I am following a tutorial that suggests it is, but I am getting the same error above.

Kind regards

Hi @got_flat, I am so sorry for this. From reviewing the entry in our bug tracker it seems @marcus also tried reproducing this, but didn’t run into the problem while it’s still happening for me.

Are you using n8n cloud by any chance? If not, can you confirm the value you have configured for N8N_DEFAULT_BINARY_DATA_MODE in your self-hosted n8n instance?

Welcome back MutedJam!

Yes I am using n8n cloud.

Let me know if you need anything else!

Thanks for confirming! I’ve let the engineering team know, hopefully this will be fixed soon :crossed_fingers: