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

Viewed 633

I want to install the gqrcode project and get from that project the following installation instructions:

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.

How can I perform something similar in go?

1 Answers

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.

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.

Related