Repository: python-poetry/poetry

Issue:
Poetry inheriting issue for git-client on github.com
- [X] I am on the [latest](https://github.com/python-poetry/poetry/releases/latest) Poetry version. 
- [X] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.
- [X] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).

- **OS version and name**: Linux Mint 20, Py3.8.2 virtualenv
- **Poetry version**: 1.1.2
- **Link of a [Gist](https://gist.github.com/) with the contents of your pyproject.toml file**: 

## Issue
While `installing` or `locking`, if the github git repo is wrong (e.g. returns a 404 in a browser), then poetry (sometimes) shows an authentication error and ask for the username for that url. 

```Updating dependencies
Resolving dependencies...
   1: fact: actions-gateway is 0.7.0
   1: derived: actions-gateway
Username for 'https://github.com':
```
The pyproject.toml has a git dependency like
```
Flask-Pika = { git = "https://github.com/rienafairefr/flask_pika.git", rev= "b2b4d68186c52ae034b39f4fb56fe86786b3a055"}
```
The typo is hard to see, it should be `flask-pika` instead of `flask_pika`

If the command is run without verbose output, then the "Username for 'https://github.com':" is sometimes shown only for a fraction of a second, so the command may never terminate and it's hard to know why.

Not sure poetry can or should mitigate the problem that comes from a lower level.

The problem comes (pretty sure) from github.com returning a 401 when it should return a 404:
```
GET /inexistent-user/inexistent-repo/info/refs?service=git-upload-pack
Host github.com
User-Agent: git/inexistent-version
```
gives us
```
HTTP/1.1 401 Authorization Required
Server: GitHub Babel 2.0
```
This makes the git client (which is called in a subprocess by poetry) to ask for authentication. 

setting the GIT_ASKPASS variable to false while caling `git` is an option, the credentials to use for a git dependency should be provided by poetry, not leaving `git` to figure it out by itself



Discussion:
At first glance I do not think this is an issue. Because there are legitimate cases where an `http` url is used and authentication is expected via CLI interaction. This probably is a different case if for example `--no-interaction` is set etc. 
Does this cause the process to hang as indicated in #2825? As in,  is the user able to enter the details required?
I've encountered it. not sure why, but it's not consistent, sometimes I could try to enter the credentials, sometimes I couldn't
As I suggested in the other issue might be better to recommend the use of https://git-scm.com/docs/gitcredentials and disable interactions as you suggested.

Resolving patch:
diff --git a/src/poetry/vcs/git/system.py b/src/poetry/vcs/git/system.py
--- a/src/poetry/vcs/git/system.py
+++ b/src/poetry/vcs/git/system.py
@@ -1,5 +1,6 @@
 from __future__ import annotations
 
+import os
 import subprocess
 
 from typing import TYPE_CHECKING
@@ -49,8 +50,14 @@ def run(*args: Any, **kwargs: Any) -> str:
             ) + args
 
         git_command = find_git_command()
+        env = os.environ.copy()
+        env["GIT_TERMINAL_PROMPT"] = "0"
         return (
-            subprocess.check_output(git_command + list(args), stderr=subprocess.STDOUT)
+            subprocess.check_output(
+                git_command + list(args),
+                stderr=subprocess.STDOUT,
+                env=env,
+            )
             .decode()
             .strip()
         )


Test patch: