如何在没有 public 密钥的情况下从 github 安装 go 库?
How to install a go library from github without public key?
我想安装 gqrcode project 并从该项目中获取以下安装说明:
go get -u github.com/KangSpace/gqrcode
执行此操作时,我首先得到:
...
fatal: could not read Username for 'https://github.com': terminal prompts disabled
...
演出后
git config --global --add url."git@github.com:".insteadOf "https://github.com/"
我得到:
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
在 python 等其他语言中,我可以先克隆库 (git clone ....
),然后再安装它。
如何在 go 中执行类似的操作?
如果它仍然使用 HTTPS URL,尽管您有全局 git 配置 url."git@github.com:".insteadOf
指令,您可能需要并尝试使用 PAT (personal access token)。
与this example一样,尝试
git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/"
(假设您有权访问存储库)
但是,考虑到 https://github.com/gqrcode itself is 404, the github.com/gqrcode/xxx
imports declared in github.com/KangSpace/gqrcode 可能需要先更新。
我想安装 gqrcode project 并从该项目中获取以下安装说明:
go get -u github.com/KangSpace/gqrcode
执行此操作时,我首先得到:
...
fatal: could not read Username for 'https://github.com': terminal prompts disabled
...
演出后
git config --global --add url."git@github.com:".insteadOf "https://github.com/"
我得到:
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
在 python 等其他语言中,我可以先克隆库 (git clone ....
),然后再安装它。
如何在 go 中执行类似的操作?
如果它仍然使用 HTTPS URL,尽管您有全局 git 配置 url."git@github.com:".insteadOf
指令,您可能需要并尝试使用 PAT (personal access token)。
与this example一样,尝试
git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/"
(假设您有权访问存储库)
但是,考虑到 https://github.com/gqrcode itself is 404, the github.com/gqrcode/xxx
imports declared in github.com/KangSpace/gqrcode 可能需要先更新。