-
Notifications
You must be signed in to change notification settings - Fork 17.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: private repos on hard-coded hosting providers require special configuration #26134
Comments
What What happens if you attempt to Are you using the credential helper? |
I don't know, I just updated it before running it... how can I know the commit?
The simple
I don't think so, I exchanged the keys with github so my remote is like
|
The error text shows the command being run. It is one of the few git commands that doesn't actually care about having a git repo to run, so you can just try it in any directory you want:
Does it work? |
Possible duplicate of #26145 but the error message from git is different (no mention of terminal prompts disabled). |
Ok, so
but
Maybe I am able to reach the repository only via ssh? |
If you can make the https form work then vgo (and old go get) will be happy. The two possible ways to do that are:
where APIKEY is an API key obtained from the GitHub API page with access to private repos. |
Retitling this to "cmd/go: github private repos require special configuration". |
The first option, adding
to |
Hi Guys, I don't know if this is the correct issue to comment on so please forgive me if it's not correct, I ended up here because of an Issue I am having with Gitlab. We have a project structure where we use subgroups for project organisation by client/project/repo. So our package import paths are 3 levels deep rather than the standard 2 you see on Github. This is fine except for an issue with
Gitlab recently did implement support for a HTTP header to override this behaviour over here: https://gitlab.com/gitlab-org/gitlab-ce/issues/42817 so we can send a We could update our import paths to include a I guess what we need is a way for |
To add to the list of options in this space (#26134 (comment)), we should also add use of a keychain/keyring as a third option (which is independent of remote VCS). Instructions vary quite widely between platforms, unsurprisingly:
I've switched back from using the ssh solution on Linux to using Gnome keyring (even though I don't use Gnome) to great effect... not least because it can be used to unify all credentials. @FiloSottile are there are any security implications that I'm unaware of with respect to the use of keychain/keyrings for this sort of thing? |
With Go tip (f2131f6) I can use private repos without modules (with the
That final git fetch fails, but that hash exists in the private repo:
And it's on the remote (it's
|
Is it possible to add a flag that causes go to clone over ssh (or any other potential future protocol)? A flag would be easy to use in CI where necessary and is more easily explained than editing a .gitconfig or .netrc. |
No, only public keys |
Can meta tags point to private repos? If so please provide an example. |
Meta tags require serving public document referencing the private branch or repo, which is data leakage and not acceptable at some sites. The Launchpad web site returns a 404 for private branches, unless you are both logged in and have been granted read access. A tool can't tell if the repo exists unless it has a valid oauth token or speaks SSH. My current workaround is to embed my private branches as git subtrees, as 'replace' in go.mod already allows me to reference a relative local path:
I think allowing 'replace' to specify full URLs would be a workable solution, or a new command, ideally without the v0.0.0 version pin. Say, theoretically:
(Interestingly, you should be able to use the existing replace to force use of a fork without changing imports, perhaps even a fork of parts of the standard library) |
DO NOT MISSING THE LAST '/' CHAR! |
I have reason to believe that this statement may have been mistaken. I plan to investigate further. This issue somehow ended up in the Proposals queue in Feb. 2021, but I'm not sure why — I think it may be just a bug. |
I've started to suspect that this may just be a problem in the way that we probe for which protocol to use. It appears that both GitHub and GitLab support SSH by having everyone use the username |
I'm a little surprised this is still an issue, I've encountered this at 3 different companies over the last 6 years, and we're always doing the .gitconfig InsteadOf dance. I got here because if you have the following setup this does NOT work: ~/.gitconfig
/company/.gitconfig-company
I guess because the git commands are being run with the gitdir being inside the GOENV rather than in the project's repo under /company/... ? |
This needs some more thought and investigation |
This is a 6yr old ticket 🤣 |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes (coming from #25590)
What operating system and processor architecture are you using (
go env
)?What did you do?
I ran
where:
What did you expect to see?
The package code in MY_REPO or the go module downloaded
What did you see instead?
The text was updated successfully, but these errors were encountered: