Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Windows: Cannot clone/checkout repository paths with spaces

I am trying to checkout a repository with paths that have spaces. git clone/checkout failed. The following error is returned

fatal: cannot create directory at 'main-path/some-folder-with-space /another-folder': No such file or directory

Resolved by:

  1. Download project zip from github.
  2. Extract the project.
  3. git init
  4. git remote add origin [email protected]:MainRepo/project.git
  5. git fetch --all

Project is now successfully cloned to my windows machine. I can checkout the remote branches without any errors.

like image 384
ariabele Avatar asked Mar 13 '17 06:03

ariabele


People also ask

Does git clone do a checkout?

The Git clone command will create a new local directory for the repository, copy all the contents of the specified repository, create the remote tracked branches, and checkout an initial branch locally.

Does git clone checkout all branches?

While you can clone repositories with the git clone command, keep in mind that this clones the branch and the remote HEAD . This is usually master by default and includes all other branches in the repository. So when you clone a repository, you clone the master and all other branches.

How do I clone a repository with all branches?

The idea is to use the git-clone to clone the repository. This will automatically fetch all the branches and tags in the cloned repository. To check out the specific branch, you can use the git-checkout command to create a local tracking branch.

What is git sparse checkout?

"Sparse checkout" allows populating the working directory sparsely. It uses the skip-worktree bit (see git-update-index[1]) to tell Git whether a file in the working directory is worth looking at. If the skip-worktree bit is set, and the file is not present in the working tree, then its absence is ignored.


1 Answers

Put the address in quotes

git clone "some/folder/with spaces/here.git"
like image 173
DeaMon1 Avatar answered Oct 21 '22 17:10

DeaMon1