Pushing from a private Github repo fails

I’d like to use a private Github repo to keep track of my project and add Balena cloud as a remote.

However I cannot push via ‘git push balena main’, this is the error I see:

[Error] Could not detect project type: Service main: Could not find a Dockerfile for this service

If I delete the .git folder (so remove the link to my private repo) and start again, it works (I see the unicorn)

I have been looking around and I couldn’t see any mentions of this and I’m starting to think the issue may be something else.

Any help is appreciated!

Hi @jhan-charler

Can you please confirm the exact steps it took to produce the error you are seeing? Is it the following?

  • In an existing local folder, you already have all your code, as well as a .git folder with remote set to your private GH repo.
  • You then do git remote add balena <application git endpoint> like explained in our docs.
  • Upon doing git push balena main, you see [Error] Could not detect project type: Service main: Could not find a Dockerfile for this service. Can you confirm that you are running this command from the project root folder?
  • Do you have a Dockerfile or docker-compose.yml the project root folder? Can you also paste its contents here?

Then, when you say it works when you “start again”, do you mean the following?

  • Delete .git folder.
  • Do git remote add balena <application git endpoint> again.
  • Then git push balena main successfully pushes the code to your balenaCloud application?

As an aside, do you have a particular motivation for using git push balena instead of balena push?

Kind regards

Hello @AlidaOdendaal,

In your first set of bullet points, you described my steps exactly.

To answer your question, I confirm that I am running the git push balena main from the root folder (i.e. where .git is).

Secondly, I’ve attached my Dockerfile and docker-compose.yml files: (note I added .txt extention at the end as I wasn’t allowed to upload):

docker-compose.yml.txt (437 Bytes)
Dockerfile.template.txt (1.5 KB)

Thirdly, when I say it works when I start again, I followed exactly the steps you shared in your second set of bullet points, except I did a git init command just after deleting the .git folder.

No particular reason for using git push balena except it was what I started with and just used to it.


The git push method is considered legacy - and if it’s all the same to you, I’d recommend moving away from that method

More about it here - Deploy to your fleet - Balena Documentation

Hi, @anujdeshpande thanks for the tip, I’ll do this :).

With balena push app_name this issue doesn’t happen. So I’ll be moving to Balena CLI to do my pushes and Github for source control. Thanks.

Hi Jhan

Great, thanks for the feedback!

Kind regards