簡體   English   中英

Git 無法從 github 簽出一個 repo

[英]Git can't checkout a repo from github

我真的很困惑。 我是一個狂熱的 github 用戶,以前從未遇到過問題。 但是,在檢查我剛剛使用 repo travis-ci/travis-core 制作的 fork 時,無論是使用 https 還是 ssh,我在 tortisegit 完成下載 git repo 之后但在第一次檢查之前遇到了這個錯誤。 有什么可能導致這種情況? 謝謝您的幫助!

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'

文件travis-ci?per_page=100.json在 Windows 上不是有效的文件名。 你可以看到 repo 中有這樣命名的實際文件,例如repos?per_page=9999.json

您可以在 cygwin 上克隆這個 repo(這樣的文件名在 cygwin shell 中是有效的),手動或通過使用git filter-branch --subdirectory-filter刪除有問題的文件,然后繼續放回您的叉子在github上。

此類錯誤的主要原因是由於 Windows 不支持存儲庫中文件的命名約定。

這樣做的簡單方法是:

  1. 一旦出現錯誤,請執行以下操作
cd <the-repo-name>
  1. 當您在目錄中時,運行以下命令
git config core.protectNTFS false
  1. 最后,使用以下命令拉 repo:
git pull <repo-url>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM