`~/.netrc` interferes with `gh auth login`
- Dominant language
- Go
- Stars
- 46.3k
- Forks
- 9k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 89
Description
### Describe the bug
`~/.netrc` will override the `git` authentication when cloning so `gh auth login` does not work as expected if you have a `~/.netrc` setup for GitHub.com already. (*Feel free to tell me this an edge case but wanted to raise this to hopefully help others not bang their head against the wall, like I did for a few minutes* 🙃 )
#### More details 👇
I had setup `~/.netrc` with the following:
```
machine github.com
login anglinb
password ...
```
I cleared out all my PATs on GitHub.com and wanted to re-authorize my `git` cli so I used `gh auth login` which succeeded but I was still unable to clone a repo. Eventually I realized what the problem was but it took me a while--I cleared my old PAT from my `~/.netrc`, ran `gh auth login` again and everything worked ✨
```
gh version 1.9.2 (2021-04-20)
https://github.com/cli/cli/releases/tag/v1.9.2
```
### Steps to reproduce the behavior
1. Put this in your `~/.netrc`
```
machine github.com
login
password
```
2. Run `gh auth login` and follow the directions
3. Run `gh clone ...` on some private repo, and see that it fails with this result:
```
gh clone https://github.com/anglinb/private-repo.git
Cloning into 'private-repo'...
remote: Repository not found.
fatal: repository 'https://github.com/anglinb/private-repo.git/' not found
```
### Expected vs actual behavior
(In an ideal world, which we might not live in 😜) I would have expected the cli to notify me about my `~/.netrc` config conflicting and instructed me to either clear the token myself of copy the new token in it's place after the authentication was successful.
### Logs
N/A
Contributor guide
Assessment
This issue has not been assessed yet.