[Support Guide] "...does not exist or you do not have permission" with failing builds

Checked by Netlify Support September 2023

When you see the following error, it can point to your repository not being set up to allow us to pull your source code:

git ref refs/heads/master does not exist or you do not have permission

There are a couple of possible causes: one reason would be if someone has removed the deploy key from your repository, which we require to fetch your source code to build. Another possibility would be your repository at your git provider had become un-linked from our service.

The easiest way to repair is to:

  • start on the ‘build and deploy settings’ page, near the top where the repository information is (Netlify App)
  • choose “edit settings”
  • then click on “link to a different repository”

Even if it is the same repository, this should fix the linkage and allow automatic deploys to work again.

Here are some git specific docs that may help: Repository permissions and linking | Netlify Docs

That should help fix most cases but if not, start a new topic and link this thread!

1 Like

Last reviewed in August 2021.