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:
Project is now successfully cloned to my windows machine. I can checkout the remote branches without any errors.
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.
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.
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.
"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.
Put the address in quotes
git clone "some/folder/with spaces/here.git"
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