Using go get with https token auth

Gogs Version: 0.12.3

My repo are not “go get-able” using go get $domain/<user>/repo on private repos

Things I’ve tried:

  1. I’ve tried switching to ssh as show below with git config but it still requires me to type go get $domain/user/repo.git. This results in my built binaries being named $project.git instead of just $project
[url "ssh://$domain:$port"]
    insteadOf = $domain

  1. I’ve tried using $token=$apikey

  2. I’ve tried using .netrc in the following configurations
    a. machine $domain, login token, password $token
    b. Machine $domain, login $token
    c. Machine $domain, login apikey, password $token
    d. Machine $domain, login $token_name, password $token
    e. machine $domain, login $token, password $token

In all cases but the first case I receive the following output:

go get $domain/$user/$repo
package $domain/$user/$repo: unrecognized import path "$domain/$user/$repo": parsed https://$domain/$user/$repo?go-get=1: no go-import meta tags ()

I’ve seen this issue come up before here. I’ve also checked these issues but none of them have exact netrc examples and I just don’t know if I’m configuring something wrong. Even worse other examples online of how to use netrc vary which is why I’ve tried so many variations above.

I’ve been racking my brain on this for hours. Thanks for reading.

git config --global url.“https://${YOUR_USER}:${YOUR_TOKEN}@${YOUR_GIT_DOMAIN}”.insteadOf “${YOUR_GIT_DOMAIN}”