简体   繁体   English

如何在没有公钥的情况下从 github 安装 go 库?

[英]How to install a go library from github without public key?

I want to install the gqrcode project and get from that project the following installation instructions:我想安装gqrcode 项目并从该项目中获取以下安装说明:

go get -u github.com/KangSpace/gqrcode

When performing this, I first got:执行此操作时,我首先得到:

...

fatal: could not read Username for 'https://github.com': terminal prompts disabled

...

After performing表演后

git config --global --add url."git@github.com:".insteadOf "https://github.com/"

I get:我得到:

git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
package github.com/KangSpace/gqrcode: exit status 1

In other languages like python I can clone the library first ( git clone .... ) and afterwards install it.在 python 等其他语言中,我可以先克隆库( git clone .... )然后安装它。

How can I perform something similar in go?我如何在 go 中执行类似的操作?

If it stills uses an HTTPS URL, despite your global git config url."git@github.com:".insteadOf directive, you might need and try using a PAT (personal access token) instead.如果它仍然使用 HTTPS URL,尽管您的全局 git config url."git@github.com:".insteadOf指令,您可能需要并尝试使用PAT(个人访问令牌)代替。

As in this example , try本例所示,尝试

git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/"

(Assuming you have access to the repository) (假设您有权访问存储库)

Howver, considering https://github.com/gqrcode itself is 404, the github.com/gqrcode/xxx imports declared in github.com/KangSpace/gqrcode might need to be updated first.但是,考虑到https://github.com/gqrcode本身是 404,在github.com/gqrcode/xxx导入可能需要先更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM