As I try to deploy a new function to Github I get this error message:
Unable to clone code repository: fatal: ' ' is not a valid branch name
hint: See `man git check-ref-format`
hint: Disable this message with "git config set advice.refSyntax false"
The error shows Git is trying to use an empty space (' ') as a branch name, which isn't valid. This usually happens when a branch name field is empty or incorrectly configured in your deployment settings. Are you deploying through GitHub Actions, or using a different CI/CD tool? I can help you fix the configuration once I know where you're setting up the deployment.
I've also been getting this exact same problem since yesterday. Usually, I just select the Quick Start Node js option when creating a new function, create a new repo through appwrite, and then the build deploys fine.
Thanks for the context! The issue is that the "Production branch" dropdown is set to "main" but your repository might not have a "main" branch yet, or there's a mismatch between what the deployment expects and what actually exists in your repo. Can you check your GitHub repository (Yousselfie/test6) - does it actually have a "main" branch, or is it using a different default branch like "master"?
The resulting repo turned out empty.
Got it the empty repo is the problem. When Appwrite tries to deploy, there's no branch to pull from, which causes the error. Here's the issue: The repository was created but no initial commit was made, so there's no "main" branch yet. You'll need to either push an initial commit to create the branch, or there might be a configuration issue in how Appwrite is creating the repo. I can help you fix this properly. Would you like to discuss this privately? I can walk you through the solution and help prevent this from happening again. Feel free to DM me if you'd like dedicated support on this.
Do NOT dm anyone, keep support in the discord. When you leave the Appwrite discord you are susceptible to scams. There is no reason to take this support out of the discord.
Hi! I still have this issue, I'd just been away for a while.
This issue also appears on repositories where I had deployed functions before and the main branch exists. I have disconnected GitHub from my Appwrite project, and uninstalled the Appwrite app from GitHub multiple times and it still persists. I also tried with a completely new Appwrite account and project (as well as with my main account with my existing projects) and it still appears.
One thing is, I haven't used Appwrite for a few months, and on one project I went from Pro tier to Free tier, but I have more functions than the Free tier supports. I assume these functions are suspended, however I didn't test them. But could this cause the issue? That I have more functions created in one of my projects than the free tier supports?
welcome back That error usually isn’t caused by plan limits or suspended functions. Even if you exceed the Free tier function limit, Appwrite would suspend execution not break GitHub cloning. The specific message (' ' is not a valid branch name) strongly suggests Appwrite is receiving an empty or malformed branch reference during deploy, often due to a stale Git integration state or a recent change in how Appwrite handles default branches. I’ve helped debug a very similar issue recently where the fix involved clearing the function’s internal repo config and re-linking with an explicit branch name (not relying on defaults), sometimes combined with recreating the function rather than just reconnecting GitHub. If you want, I’m happy to take a quick look at your setup and help you pinpoint it fast—this one is subtle but very fixable.
Thanks! I'll probably subscribe to Pro tier tomorrow anyways. So I'll see if it was a plan limit. I'll be back tomorrow
I just created a brand new GitHub account and I still get the same error on the first deploy
Unable to clone code repository: fatal: '' is not a valid branch name
hint: See `man git check-ref-format`
hint: Disable this message with "git config set advice.refSyntax false"
When I try to manually redeploy the function again, I get this instead:
2026-01-19T09:13:51.246311990Z [09:13:51] [open-runtimes] Environment preparation started.
2026-01-19T09:13:51.248257194Z [09:13:51] [open-runtimes] Error: No source code found. Ensure your source isn't empty.
2026-01-19T09:13:56.000000000Z Build archive was not created.
The only fix I found so far is to not connect GitHub. Then when the function deploys from Appwrite's funtion templates repo, I can download the source code and manually upload it to my private repo. Then connect my GitHub repo on Appwrite dashboard and it should finally deploy.
I'd like to kindly ask <@870607367597850624> developers to look into this problem. At this point I don't believe the issue is on my end, since I created new accounts on both Appwrite and GitHub and still get the same issue.
<@870607367597850624> bumb up, i have exactly the same issue, even on create a brand new function from appwrite dashboard
I forgot I had this issue. Still not fixed 🙁
I'll get someone from the team to take a look.
Hey community 👋 Ill be looking into this nwo
I believe problem is with new functions created from template, while being connected to git during creation 🤔 I would assume it's problem with specific templates. Ill try to find problematic ones and fix them all
After further investigation, I notied flow is not reaching cloning of template; Cloning of newly created empty repository must be the issue
No change in cloning logice in past 2 years 🤔 Must be a change with Git CLI or GitHub
Reproduced 🥳
Fix merged; Will be releasing Cloud soon, just want to address one more bug first https://github.com/appwrite/appwrite/pull/11269
while you are at it another bug is , a new project asks for github integration with appwrite . But Appwrite is already installed in the github. as it is already installed in that account, Its a bit confusing to redirect back. It should be one time thing for whole organization or account level imo. Currently github is acting weird . If you are free can you look into it and tell me if its intented?
We are looking in to this, in communication with github too. For now, you will need to click "configure", click "save", and that re-authorizes. You get redirected to Console, and can see the repositories
Its either github or appwrite acting weird. Or both https://discord.com/channels/564160730845151244/1102936099745177700/1470456338873061508
Recommended threads
- MongoDb Database Breaks integer[] & bigi...
I've got a table with the below column created. When I try to insert the value `[-3408048000]` into it, the dart sdk cloud function call is successful (no error...
- Appwrite Functions cold start
Hello. I'm seeing really long cold starts on Appwrite Cloud Functions and wanted to know if this is expected. My function just authenticates the user, fetches ...
- Error can not create `tablesdb` event wi...
When i'm trying to add an event with `tablesdb` i get an error message My event value: `tablesdb.mtg-decklist-dev.tables.queue_parsing.rows.*.create` Same err...