New deploy overwrites previous ones

Hello Netlify Community,

I am new to Netlify and can’t seem to find any similar problems in the previous community posts.

I’m having an issue whereby whenever I deploy a new project to Netlify, it is overwriting the last one that I deployed. I have found that a solution is to run netlify unlink before every new netlify init I do but wondered if there’s a way I can get around having to do this, as I didn’t have to do this with my first couple of projects a few weeks ago.

I have tried running netlify unlink at various levels of my file structure to see if I had accidentally linked to netlify higher up in my files but that didn’t seem to be the case.

I have uninstalled and then reinstalled netlify-cli which hasn’t helped either.

An example is which was originally a portfolio but got overwritten by a demo art site I tried to upload.

Any help would be greatly appreciated and apologies if I’ve missed out any required details.


Hey @AKP-13 :wave:t2:

Welcome to the Community!

It sounds like you may be using one large, single repository for your websites. Is that correct?

If so, you may want to read this guide and its associated links for mono-repo support!


Hi @jonsully,

Thanks very much for your reply :slight_smile:!

I’m not, no :confused: - I have different repos for the different websites.

Just tried seeing if I had a git repo in parent folders that could be somehow messing it up but didn’t seem to.

Thanks again for your response!

Hi, @AKP-13. I’m showing that site isn’t being deployed with the CLI. All the deploys (there are only two) were builds at Netlify made by cloning the GitHub repo linked to the site.

These builds would be triggered by a git push and not the CLI tool.

I don’t show any other sites for this account.

It isn’t clear to me how you are using the Netlify CLI tool. Would you please explain your workflow with that tool?

Hi @luke.

Okay, I’ve just deleted the site I had hosted on Netlify and am going to start the process over again and write out what steps I make, hopefully will make it easy to spot my mistake.

-So this first project isnt hosted on github, the code is stored locally:

  • cd into my portfolio folder
  • netlify init
  • Yes, create and deploy site manually, selected my team name, left site name as default name
  • netlify deploy, publish directory (.), checked the draft version, was all good
  • netlify deploy --prod, publish directory (.)

-This code is hosted on GitHub:

  • cd into a separate folder that contains another project.
  • netlify init
  • Your build command to which I kept it as npm run build
  • Directory to deploy - I kept as the default
  • Then it says run git push to trigger new site builds…how come it isnt showing me the same sort of questions as the first project? And at this point the portfolio site is overwritten by this second project.

I hope I’ve been clear in my steps, let me know if you need more information.
Thanks again and thanks in advance to whoever looks at this!

My best guess is you already linked that repo to a Netlify site. This is based on the .gitignore file for this repo:

It is ignoring a .netlify subdirectory. That subdirectory contains a configuration which links that specific directory to a specific site.

If you don’t want it linked, change into that repo directory and do one of two things:

  • run the command netlify unlink
  • run the command rm -Rf ./.netlify

The first command would unlink the site. The second command would completely delete the directory and the file(s) it contains. Either should resolve the issue.

If not or if there are other questions, please let us know.

1 Like

Hi @luke,

Thanks very much for your response.

I’ve found that deleting the hidden .netlify folder has indeed solved the problem.

Kind regards,
Alex. :slight_smile:

1 Like