j-diaz
j-diaz

Reputation: 21

go: github.com/myorg/[email protected]: reading github.com/myorg/myrepo/go.mod at revision v0.0.4: unknown revision v0.0.4

go: github.com/myorg/[email protected]: reading github.com/myorg/myrepo/go.mod at revision v0.0.4: unknown revision v0.0.4

I'm hitting the above blocker when go mod tidy inside a different private repo call it: github.com/myorg/myrepo2 and attempting to fetch from my private repo github.com/myorg/myrepo

Contents of github.com/myorg/myrepo master branch go.mod (at the root project level)

module github.com/myorg/myrepo

go 1.15

require (
    github.com/abadojack/whatlanggo v1.0.1
    github.com/mmcdole/gofeed v1.1.3
    github.com/stretchr/testify v1.3.0
)

The repo has in fact a tag / release named v0.0.4

Additionally, I've tried everything described in the following:

That is to say, I've tried configuring ~/.gitconfig, GOPRIVATE and other env vars, ~/$HOME/.netrc,and even generating a GitHub access token. I should note that I also have an SSH key associated with Github account on this machine and ~/.ssh/config contents as below:

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed12345

Host github.com
  Hostname ssh.github.com
  Port 443

I also ruled out the submodule issue described here reading github.com/username/kit/go/database/go/database/go.mod at revision go/database/v1.0.1: unknown revision go/database/v1.0.1

I'm at a loss on this one so any help would be appreciated.

Upvotes: 2

Views: 634

Answers (1)

VonC
VonC

Reputation: 1324268

If Go is accessing your private repository through HTTPS, then any SSH setting would not be used at all.
From your link, this should have helped (after a go clean -modcache):

git config --global \
  url."https://${GITHUB_TOKEN}@github.com".insteadOf \
  "https://github.com"
go mod download

If you want to use/try SSH:

git config --global url."ssh://[email protected]:acme-corporation".insteadOf "https://github.com/acme-corporation"

(replace acme-corporation by your GitHub user account, assuming your private repository is not in an organization)
(check ssh -Tv [email protected] does authenticate as you)

Then export GIT_SSH_COMMAND='ssh -Tv': that way, you will see exactly what is considered during the SSH calls, and make sure your private key is indeed used.


The OP j-diaz confirms in the comments an issue in their Git configuration:

I ended up revising every entry in my .gitconfig file and ended up removing everything except the user entry and that made it work.

[user] 
  name = First Last 
  email = [email protected]

Upvotes: 1

Related Questions