Skip to content

Instantly share code, notes, and snippets.

@ozh
Forked from davisford/gist:5039064
Last active September 7, 2021 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ozh/ad8ea6aa7205e198fcc544ba9a39f471 to your computer and use it in GitHub Desktop.
Save ozh/ad8ea6aa7205e198fcc544ba9a39f471 to your computer and use it in GitHub Desktop.
git clone into non-empty directory

You have a folder with files

$ mkdir -p ~/foo && cd ~/foo
$ touch NEWFILE

You cannot git clone into it because the directory is not empty. To do so:

$ cd ~/foo
$ git init
$ git remote add origin https://github.com/YOU/YOURPROJECT.git
$ git fetch
$ git branch master origin/master
$ git checkout master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment