英文:
Unsupported URL protocol
问题
我正在尝试创建一个基本的GO应用程序,使用git2go来拉取一个Git仓库,但是我遇到了一个错误,提示不支持的URL协议。有人知道为什么吗?
package main
import (
git "github.com/libgit2/git2go"
"log"
)
func main() {
cloneOptions := &git.CloneOptions{}
repo, err := git.Clone("https://github.com/nova-framework/framework.git", "gittest", cloneOptions)
if err != nil {
log.Panic(err)
}
log.Print(repo)
}
英文:
I'm trying to create a basic GO app to pull a Git repo using git2go but I'm getting an error saying unsupported URL protocol. Does anyone know why?
package main
import (
git "github.com/libgit2/git2go"
"log"
)
func main() {
cloneOptions := &git.CloneOptions{}
repo, err := git.Clone("https://github.com/nova-framework/framework.git", "gittest", cloneOptions)
if err != nil {
log.Panic(err)
}
log.Print(repo)
}
答案1
得分: 2
你的libgit2可能没有使用所需的标志进行HTTPS编译:https://github.com/libgit2/libgit2/blob/b7809b84692b4df7f11d603cc5da0860609e0555/src/transport.c#L32-L34
预处理器正在寻找以下定义之一:
GIT_OPENSSL,GIT_WINHTTP,GIT_SECURE_TRANSPORT
根据README,看起来你需要这三个,这可能导致满足要求:
> ZLIB_LIBRARY,OPENSSL_SSL_LIBRARY和OPENSSL_CRYPTO_LIBRARY:告诉
> CMake在哪里找到这些特定的库
英文:
Your libgit2 was probably not compiled with the required flags for HTTPS: https://github.com/libgit2/libgit2/blob/b7809b84692b4df7f11d603cc5da0860609e0555/src/transport.c#L32-L34
The pre-processor is looking for one of these to be defined:
GIT_OPENSSL, GIT_WINHTTP, GIT_SECURE_TRANSPORT
From the README, it looks like you need these three, which probably cause the requirements to be met:
> ZLIB_LIBRARY, OPENSSL_SSL_LIBRARY AND OPENSSL_CRYPTO_LIBRARY: Tell
> CMake where to find those specific libraries
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论