"Directory (/tmp) you are trying to checkout to is not empty and not git repository"

The circleci build used to be successful. I tried to clean-up the circle.yml today, and start to fail at the checkout code step.

The old circle.yml file (simplified):

version: 2
jobs:
  build:
    working_directory: /tmp
    docker:
      - image: python:3.4.4
        environment:
          some environment variables
      - image: mysql:5.7
        environment:
          some environment variables
      - image: selenium/standalone-chrome:3.1.0
    steps:
      - checkout
      - run:
          ...
      - save_cache:
          ...
      - run:
          ...

During the clean-up, I removed the unused environment variables & save_cache, so the current circle.yml:

version: 2
jobs:
  build:
    working_directory: /tmp
    docker:
      - image: python:3.4.4
      - image: mysql:5.7
        environment:
          some environment variables
      - image: selenium/standalone-chrome:3.1.0
    steps:
      - checkout
      - run:
          ...
      - run:
          ...

however, i’m keep on getting the following message at the checkout step:

Directory (/tmp) you are trying to checkout to is not empty and not git repository

I’ve also provided the screenshot to illustrate this:

the error persisted even when I tried to rebuild without cache.

ps: forgot to mentioned, when i simulated it in my local with circleci build, everything worked fine and i don’t see this error at all.

1 Like

Seeing the same

1 Like

i fixed by changing the working_directory to some different folder.

i did a ls -ahl in /tmp, and there were some temporary folders left from previous build. unfortunately i wasn’t able to remove those folders with the rm command.

1 Like

Yeah, just figured the same out. Thanks. I noticed that “checkout”-related docs were not using /tmp.