简体   繁体   中英

Git can't checkout a repo from github

I am really confused with this. I am a avid github user and never have had a problem before. However, when checking out a fork I just made of the repo travis-ci/travis-core, whether using https or ssh, I run into this bug after tortisegit finished downloading the git repo but before checking it out for the first time. Anything that could cause this? Thanks for the help!

remote: Counting objects: 29130, done.
remote: Compressing objects: 100% (16427/16427), done.
Receiving objects: 100% (29130/29130), 8.37 MiB | 265.00 KiB/s, done.
Resolving deltas: 100% (13171/13171), done.
remote: Total 29130 (delta 13171), reused 27543 (delta 11662)
error: unable to create file spec/fixtures/github/api.github.com/orgs/travis-ci?per_page=100.json (Invalid argument)
error: unable to create file spec/fixtures/github/api.github.com/users/svenfuchs?per_page=100.json (Invalid argument)
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

The file travis-ci?per_page=100.json is not a valid filename on Windows. You can see that there are actual files named like this in the repo, eg repos?per_page=9999.json

You can maybe clone this repo on cygwin (such a filename would be valid in a cygwin shell), remove the offending files, manually or by filtering the branch with git filter-branch --subdirectory-filter and then proceed to put your fork back on github.

The main cause of this type of error is due to windows not supporting the naming convention of a file in the repository.

The simple way of doing it, is to:

  1. As soon as the error comes up, do the below
cd <the-repo-name>
  1. When you are in the directory run the below command
git config core.protectNTFS false
  1. Finally, pull the repo using:
git pull <repo-url>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM