Export failed for github.com/hashicorp/consul: Unable to export source: exit status 128

Posted jwentest

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Export failed for github.com/hashicorp/consul: Unable to export source: exit status 128相关的知识,希望对你有一定的参考价值。

背景 

go项目,使用glide install命令去下载安装依赖,依赖中有个github.com/hashicorp/consul

 

问题描述

一直无法下载安装依赖成功,报错如下:

 

[ERROR] Export failed for github.com/hashicorp/consul: Unable to export source: exit status 128
[ERROR] Unable to export dependencies to vendor directory: Unable to export source: exit status 128

 

解决思路

先日了狗表达心情!

一顿google,发现提供的思路都差不多为:

 

glide cc

rm -rf vendor

尝试了无数次后都是失败了

在google的过程中,有的人建议贴出debug日志,无奈最后就自己加上了debug日志,得到了如下

 

具体日志

 

[ERROR] Export failed for github.com/hashicorp/consul: Unable to export source: exit status 128

[DEBUG] Output was: error: unable to create file C:\\\Users\\\M\\\AppData\\\Local\\\Temp\\\glide-vendor249536483\\\vendor\\\github.com\\\hashicorp\\\consul\\\vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitauthorizations.go: Filename too long[DEBUG]

Unlocking https-github.com-hashicorp-consul

[ERROR] Unable to export dependencies to vendor directory: Unable to export source: exit status 128

[DEBUG] Output was: error: unable to create file C:\\\Users\\\M\\\AppData\\\Local\\\Temp\\\glide-vendor249536483\\\vendor\\\github.com\\\hashicorp\\\consul\\\vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitauthorizations.go: Filename too long

日了狗,看描述大概明白了,glide在执行新建文件的时候发现文件名过长了!!!

 

解决办法

那么问题就演变成了glide error filename too long的问题了

具体方法:

 

Enable long paths on Windows (requires Windows 10 Anniversary Update or newer): https://superuser.com/a/1119980/97078

Configure git to use long paths: git config --global core.longpaths true (globally) or git config core.longpaths true (per project)

我执行了第二步就解决了问题,那么大概就是glide 会去使用git去拉取代码和创建文件了的 

 

小结

还是问题的官方日志靠谱,遇到问题先获取更多的日志吧

 

 

以上是关于Export failed for github.com/hashicorp/consul: Unable to export source: exit status 128的主要内容,如果未能解决你的问题,请参考以下文章

解决报错:fatal: Authentication failed for ‘https://github.com/*/*.git/‘

解决报错:fatal: Authentication failed for ‘https://github.com/*/*.git/‘

Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private

git sync fatal: Authentication failed for https://github.com/ did not exit cleanly (exit code 128)(代

xcrun xcodebuild ** EXPORT FAILED ** 安装 Xcode9 后

redmine export long csv file failed: 502 proxy error