user733733
user733733

Reputation: 183

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:

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."[email protected]:".insteadOf "https://github.com/"

I get:

[email protected]: 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?

Upvotes: 2

Views: 3866

Answers (1)

VonC
VonC

Reputation: 1323203

If it stills uses an HTTPS URL, despite your global git config url."[email protected]:".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}:[email protected]/".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.

Upvotes: 2

Related Questions