SourceTree克隆GitHub大仓库提示错误但无详情求助
解决SourceTree SSH克隆GitHub大型仓库空文件夹且无明确错误的问题
问题描述
尝试通过SSH使用SourceTree克隆GitHub上的大型仓库,耗时数小时后仅得到空文件夹,执行的Git命令及提示如下:
git --no-optional-locks -c filter.lfs.smudge= -c filter.lfs.required=false -c color.branch=false -c color.diff=false - c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree clone git@github.com:Foobar/Foo.git /Users/MyMacUser/Foo Completed with errors, see above
无法识别具体错误,此前HTTPS克隆方式也报错,当前使用MacOS 14.5系统。
解决步骤
1. 查看SourceTree完整错误日志
SourceTree默认会隐藏详细错误输出,调出完整日志:
- 打开SourceTree,点击顶部菜单栏
View->Show Log - 在日志面板筛选
Git Command相关条目,找到对应克隆操作的完整输出,里面会包含具体错误原因(如SSH权限、克隆超时、LFS配置问题等)
2. 终端手动执行克隆命令排查
跳过SourceTree直接用终端运行克隆命令,能实时看到详细错误:
git clone git@github.com:Foobar/Foo.git /Users/MyMacUser/Foo
如果仓库使用Git LFS存储大文件,改用LFS克隆命令:
git lfs clone git@github.com:Foobar/Foo.git /Users/MyMacUser/Foo
常见问题对应处理:
- 若提示
Permission denied (publickey):按步骤3修复SSH配置 - 若克隆超时:先执行以下命令调整Git超时设置,再重新克隆
git config --global http.lowSpeedLimit 0 git config --global http.lowSpeedTime 999999 - 若仓库过大导致克隆失败:先浅克隆最近一次提交,再拉取完整历史
git clone --depth 1 git@github.com:Foobar/Foo.git cd Foo git fetch --unshallow
3. 验证SSH连接有效性
在终端执行命令检查SSH是否能正常连接GitHub:
ssh -T git@github.com
返回Hi [你的GitHub用户名]! You've successfully authenticated, but GitHub does not provide shell access.说明配置正常;若报错:
- 检查本地SSH密钥:
ls -la ~/.ssh,确认存在id_rsa或id_ed25519等密钥文件 - 无密钥则生成新密钥:
ssh-keygen -t ed25519 -C "你的GitHub绑定邮箱"(一路回车采用默认设置) - 将公钥添加到GitHub:复制
~/.ssh/id_ed25519.pub的内容,粘贴到GitHub账户的Settings->SSH and GPG keys->New SSH key中
4. 调整SourceTree的Git配置
打开SourceTree偏好设置优化配置:
- 点击顶部菜单栏
SourceTree->Settings->Git - 选择系统安装的Git版本(而非SourceTree内置版本),避免兼容性问题
- 若仓库使用LFS,勾选
Enable Git LFS选项
内容的提问来源于stack exchange,提问作者bosphorus
相关产品推荐
相关产品推荐

