Repository: huggingface/huggingface_hub

Issue:
AttributeError: 'NoneType' object has no attribute 'split'
### Describe the bug

When I try to log into my account with the token via `huggingface-cli login`, I get this error:
```
Exception in thread Thread-1 (_readerthread):
Traceback (most recent call last):
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1494, in _readerthread
    buffer.append(fh.read())
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xee in position 387: invalid continuation byte
Traceback (most recent call last):
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\Scripts\huggingface-cli.exe\__main__.py", line 7, in <module>
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\commands\huggingface_cli.py", line 47, in main
    service.run()
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\commands\user.py", line 117, in run
    login()
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\_login.py", line 91, in login
    interpreter_login()
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\_login.py", line 137, in interpreter_login
    _login(token=token, add_to_git_credential=add_to_git_credential)
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\_login.py", line 231, in _login
    if _is_git_credential_helper_configured():
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\_login.py", line 251, in _is_git_credential_helper_configured
    helpers = list_credential_helpers()
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\utils\_git_credential.py", line 44, in list_credential_helpers
    for line in output.split("\n")
AttributeError: 'NoneType' object has no attribute 'split'
```
Also, when using `huggingface-cli env`, I got this error. I dunno if it's related, but here it is anyway:
```
Exception in thread Thread-1 (_readerthread):
Traceback (most recent call last):
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1494, in _readerthread
    buffer.append(fh.read())
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xee in position 387: invalid continuation byte
```

### Reproduction

The commands I've used:
```
git clone https://github.com/harishanand95/diffusers.git
cd diffusers && git checkout dml && pip install -e .
pip install transformers ftfy scipy
pip install ort_nightly_directml-1.13.0.dev20220901005-cp310-cp310-win_amd64.whl
cd ./diffusers/examples/inference
huggingface-cli login
```

### Logs

_No response_

### System info

```shell
- huggingface_hub version: 0.11.0
- Platform: Windows-10-10.0.19044-SP0
- Python version: 3.10.4
- Running in iPython ?: No
- Running in notebook ?: No
- Running in Google Colab ?: No
- Token path ?: C:\Users\mikwee\.huggingface\token
- Has saved token ?: False
- FastAI: N/A
- Tensorflow: N/A
- Torch: 1.13.0
- Jinja2: N/A
- Graphviz: N/A
- Pydot: N/A
```



Discussion:
Hi @mikwee thanks for reporting and sorry you are getting this issue.

Do you happen to know why the exception is raised in a child Thread instead of the main thread ? I have been able to reproduce a similar issue locally but `subprocess.run` shouldn't be running in a thread (at least not by default for what I thought). Also you have been able to dump your machine details. Does it mean that `huggingface-cli env` raises an error but is still able to print the debug information ?

Also, could you copy-paste me the output when you run `git config --list` (potentially remove if there are sensitive information in it) ? That would help investigating.
1. No, I honesly don't know much about threads on Windows, and only a little about threads on JS.
2. Yes.
3.
```
git config --list
core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
diff.astextplain.textconv=astextplain
rebase.autosquash=true
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=helper-selector
gui.recentrepo=D:/<EE><F1><EE><EB><E9><ED>/Git/Now
gui.recentrepo=D:/<D7><9E><D7><95><D7><A1><D7><99><D7><A7><D7><94>/<D7><9E><D7><A1><D7><9E><D7>D7><99><D7><9D>/RMS Open Letter/rms-open-letter.github.io
gui.recentrepo=D:/example-codeberg
user.name=mikwee
user.email=[email]
user.username=mikwee
filter.lfs.required=true
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
remote.origin.url=https://github.com/harishanand95/diffusers.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.main.remote=origin
branch.main.merge=refs/heads/main
branch.dml.remote=origin
branch.dml.merge=refs/heads/dml
```
Also note: I tried this again, and before the error it told me my token was valid... which is good, but not really useful if I can't log into my account. I have no idea if this matters, but more info is always good.

Resolving patch:
diff --git a/src/huggingface_hub/utils/_subprocess.py b/src/huggingface_hub/utils/_subprocess.py
--- a/src/huggingface_hub/utils/_subprocess.py
+++ b/src/huggingface_hub/utils/_subprocess.py
@@ -64,6 +64,7 @@ def run_subprocess(
         stdout=subprocess.PIPE,
         check=check,
         encoding="utf-8",
+        errors="replace",  # if not utf-8, replace char by �
         cwd=folder or os.getcwd(),
         **kwargs,
     )
@@ -110,6 +111,7 @@ def run_interactive_subprocess(
         stdout=subprocess.PIPE,
         stderr=subprocess.STDOUT,
         encoding="utf-8",
+        errors="replace",  # if not utf-8, replace char by �
         cwd=folder or os.getcwd(),
         **kwargs,
     ) as process:


Test patch: