Cloning non-existent repository asks for authentication
Problem
Cloning non-existent repository asks for authentication. (Fail instead of asking for credentials)
$ git clone https://gitlab.com/does-not-exist-group-f34f2/dne-123.git
Cloning into 'dne-123'...
Username for 'https://gitlab.com/':
I didn't realize the typo in the URL right away so I Googled whether I could clone a public repository without authentication and my expectations were correct so I looked at the command closer
I got into this situation because I manually typed a repo URL into a virtual machine(VM) where I didn't have shared clipboard on to paste easily.
Proposal
Are we asking for authentication to not expose a 404 project that could potentially be a private project? In any case, I mis-typed the group name which is exposed anyway because you can go to the group creation page and try to create a group with the same name (returns "Path has already been taken" error)
Ideally, we could return fatal: repository 'dne-123' does not exist
(normal error for git, try git clone asdf
) for this case.
Not sure if we can add a message to that git command output, but if possible, we could add a message about the project not existing or needing authentication/permissions to see it. This would have clued me in on the URL being wrong instead of having to guess whether anonymous public clones are possible.
Related issues
- https://serverfault.com/questions/544156/git-clone-fail-instead-of-prompting-for-credentials
- https://help.github.com/articles/error-repository-not-found/
- https://help.github.com/articles/https-cloning-errors/#check-your-permissions
cc @jramsay