Checkout started to fail from one moment to another (Directory not empty and not git repository)

Hi there.

I had a project running circleci 2.0, with tests and deploy to AWS (based on tags)

On the other day, I’ve also added circleci 2.0 to another project (based on the same account), and basically made a copy from config file, only swapped the cache keys and folder.

Yet, the project #1 build started to fail. It breaks on the checkout code part, giving the error “Directory (/home/circleci/src) you are trying to checkout to is not empty and not git repository”.

I’ve tried to change the folder to another thing, yet, it always gives me the same error.

Here’s my config file from project #1

The build on the #2 project works fine, yet, #1 fails always.

I know that the working directory (and cache one) are the same directory on both projects, yet, I’ve tested with random folder names, and it gives me the same error on.

Thanks for the support

I’d expect both of them to fail, to be honest. You’re trying to save/restore ~/src to the cache, and also checkout to it. These strike me as conflicting operations, and you should do one or the other.

Hi there.

Thanks for the answer @halfer. Though, doesn’t seem to be the problem.

I’ve swapped the folders from #2 project to some other randomly, and it still builds without any problem.

Yet, on the #1 project, it keeps to give the same error (Directory (/home/circleci/up-hill/newfolder) you are trying to checkout to is not empty and not git repository)

I’ve disabled the save_cache and restore_cache steps, yet, same error

Here’s the new config:

Thanks for the help

Your restore_cache and save_cache are still in your config.

Thanks for the answer @halfer. Yet, that restore_cache and save_cache is only on the deploy job.

Anyway, i’ve removed also removed those restore_cache and save_cache from the deploy job, and it keeps failing on me. (Also swapped to another folder)

Here’s the new config:

Have no clue what else to do to find out what is failing :frowning:

Hmm, ok, more things to try:

  • Put a new run step that does a ls -lR /home/circleci/src before your checkout. It’d be interesting to see what this comes up with
  • I wonder what the real value of “anotherfolder” is here ~/up-hill/anotherfolder. Is there any value in just getting rid of this? I don’t know what value there is in not using the default working dir.
  • Ooh, I just noticed you are doing yarn install before a checkout - does this not need the dependencies file in your repo in order to work?

Hi @halfer.

Thanks for the help… It was yarn install that was bugging it out. Strange that it wasn’t previously. Might have changed something during some process…


1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.