cli/pkg/cmd/auth/setupgit
Des Preston 94a640bd2a
Add auth setup-git for setting up gh as a git credential helper (#4246)
Adds a new command `gh auth setup-git [<hostname>]` that sets up git to
use the GitHub CLI as a credential helper.

The gist is that it runs these two git commands for each hostname the
user is authenticated with.

```
git config --global --replace-all 'credential.https://github.com.helper' ''
git config --global --add 'credential.https://github.com.helper' '!gh auth git-credential'
```

If a hostname flag is given, it'll setup GH CLI as a credential helper
for only that hostname.

If the user is not authenticated with any git hostnames, or the user is
not authenticated with the hostname given as a flag, it'll print an
error.

Co-authored-by: Mislav Marohnić <mislav@github.com>
2021-12-02 16:38:34 +00:00
..
setupgit.go Add auth setup-git for setting up gh as a git credential helper (#4246) 2021-12-02 16:38:34 +00:00
setupgit_test.go Add auth setup-git for setting up gh as a git credential helper (#4246) 2021-12-02 16:38:34 +00:00