I'm doing:
git clone ssh://[email protected]/home/user/private/repos/project_hub.git ./
I'm getting:
Fatal: destination path '.' already exists and is not an empty directory.
I know path . already exists. And I can assure that directory IS empty. (I do ls inside and I see nothing!)
What am I missing here in order to clone that project into the current directory ?
However, you can only clone into an existing directory only when it is empty. Otherwise, git will complain that the destination path already exists and is not an empty directory. That's all about cloning a Git repository into a specific folder.
Clone to the current directory To specify the current directory the symbol dot is used. So to clone repo to the current directory you need to specify two parameters to git clone: the url of the repo. just one symbol — dot — "." — it means current directory.
You might discover that the source files were there before, but were removed in a subsequent commit. If so, just git checkout to an older commit. Also possible that there's simply no files in the master branch ( git log --all will show other branches). See git branch for list and git checkout another branch.
To clone a git repository into specific folder we use below command git clone <cloning_url> </fath/to/the/folder> Here we are mentioning where to clone the repository. so it will clone the repository into that specified path.
Since the directory Delftscopetech already exists and contains some files, we cannot use the git clone command to clone our repository. If you don’t need the files in the directory, you can delete them, but if you want to merge the files in both repositories, use the method below.
git clone --bare ¶ With the --bare argument passed to git clone, you will have a copy of the remote repo created with an excluded working directory. So, the repository will be created with the project history which can be pushed or pulled from but cannot be edited. git clone --mirror ¶
You can check the current branch cloned by running the “git branch” command. However, in some cases, you may want to clone a specific branch in order to start working. Your team may have chosen to let the “master” branch a bit behind and to have the most recent commits directly to the “dev” branch for example.
simply put a dot next to it
git clone [email protected]:user/my-project.git .
From git help clone
:
Cloning into an existing directory is only allowed if the directory is empty.
So make sure the directory is empty (check with ls -a
), otherwise the command will fail.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With