不支持的URL协议

huangapple go评论78阅读模式
英文:

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

huangapple
  • 本文由 发表于 2016年4月5日 04:27:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/36412273.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定