gogithubinstallationbinary

go install from private repository


I'm trying to install a Go binary via go install from my own private repository on github. I am able to get my repository to use the sdk, but not to install.

Here is my setup in ~/.gitconfig:

[url "ssh://git@github.com/"]
  insteadOf = https://github.com
go env -w GOPRIVATE=github.com/bob/tools/*

SSH key is configured and I can clone the repo.

go get github.com/bob/tools/

I have an entry like github.com/bob/tools/cmds/fetcher which contains a main. However, I can't run go install github.com/bob/tools/cmds/fetcher@latest.

go: github.com/bob/tools/cmds/fetcher@latest: module github.com/bob/tools/cmds/fetcher: git ls-remote -q origin in /home/bob/go/pkg/mod/cache/vcs/871d703a8ea54eb81cf10cda6cc3d10e1e0e0c5415de9cd3e34f19ea8058e12e: exit status 128:
    fatal: remote error:
     /bob/tools is not a valid repository name
    Visit https://support.github.com/ for help

I feel it might be an issue with ssh to https. How can I solve it?


Solution

  • Found the issue to my problem after hours of pulling my hair!

    [url "ssh://git@github.com/"]
      insteadOf = https://github.com
    

    it is missing a slash after .com

    [url "ssh://git@github.com/"]
      insteadOf = https://github.com/