Skip to content

Commit f89105b

Browse files
authored
Update multiuser docs to show default config (#1371)
Add a section about how to set the default user globally for all repos in a particular host provider.
2 parents 4e2a898 + f839317 commit f89105b

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

docs/multiple-users.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,23 @@ or by running `git credential-manager github --help`.
9797

9898
## TL;DR: Tell GCM to remember which account to use
9999

100-
The easiest way to have GCM remember which account to use for which repository
101-
is to include the account name in the remote URL. If you're using HTTPS remotes,
102-
you can include the account name in the URL by inserting it before the `@` sign
100+
To set a default account for a particular remote you can simply set the
101+
following Git configuration:
102+
103+
```shell
104+
git config --global credential.<URL>.username <USERNAME>
105+
```
106+
107+
..where `<URL>` is the remote URL and `<USERNAME>` is the account you wish to
108+
have as the default. For example, for `github.com` and the user `alice`:
109+
110+
```shell
111+
git config --global credential.https://github.com.username alice
112+
```
113+
114+
If you wish to set a user for a specific repository or remote URL, you can
115+
include the account name in the remote URL. If you're using HTTPS remotes, you
116+
can include the account name in the URL by inserting it before the `@` sign
103117
in the domain name.
104118

105119
For example, if you want to always use the `alice` account for the `mona/test`

0 commit comments

Comments
 (0)