Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8064e2e

Browse files
authoredAug 11, 2023
GCM Release 2.3.1 (#1376)
Changes: - Ensure only unique accounts are returned from credential store - Issue: #1368 - PR: #1369 - Migrate GCM from `microsoft/homebrew-git` to `Homebrew/homebrew-core` tap - Issue: #1102 - PR: #1374
2 parents 58e34e3 + 2400fed commit 8064e2e

File tree

16 files changed

+143
-33
lines changed

16 files changed

+143
-33
lines changed
 

‎.github/workflows/release-homebrew.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ jobs:
99
environment: release
1010
steps:
1111
- name: Update Homebrew tap
12-
uses: mjcheetham/update-homebrew@v1.3
12+
uses: mjcheetham/update-homebrew@v1.4
1313
with:
1414
token: ${{ secrets.HOMEBREW_TOKEN }}
15-
tap: microsoft/git
16-
name: git-credential-manager-core
15+
tap: Homebrew/homebrew-cask
16+
name: git-credential-manager
1717
type: cask
18+
alwaysUsePullRequest: true
1819
releaseAsset: |
1920
gcm-osx-x64-(.*)\.pkg
2021
gcm-osx-arm64-(.*)\.pkg

‎VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0.0
1+
2.3.1.0

‎docs/faq.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,51 @@ demonstration purposes).
230230
5. Re-authorizing the application with the new scope (GCM should automatically
231231
initiate this flow for you next time access is requested).
232232

233+
### Q: What do the `configure` and `unconfigure` commands do?
234+
235+
#### `configure`
236+
237+
The `configure` command will set up Git to use GCM exclusively as the credential
238+
helper. The `configure` command is automatically called by the installers for
239+
Windows and macOS, but you can also run it manually.
240+
241+
It will also set Git to provide the full remote URL (including path) to
242+
credential helpers for Azure Repos remotes using the `dev.azure.com` URL format.
243+
This is required in order to be to able to correctly identify the correct
244+
authority for that Azure DevOps organization.
245+
246+
Specifically, the `configure` command will modify your user Git configuration to
247+
include the following lines:
248+
249+
```ini
250+
[credential]
251+
helper =
252+
helper = <path-to-gcm>
253+
[credential "https://dev.azure.com"]
254+
useHttpPath = true
255+
```
256+
257+
..where `<path-to-gcm>` is the absolute path to the GCM executable.
258+
259+
The empty `helper =` line makes sure that existing credential helpers that may
260+
be set in the system Git configuration are not used. For more details see the
261+
[credential.helper][helper-config-docs].
262+
263+
If you pass the `--system` option, the `configure` command will instead modify
264+
the system Git configuration. This is useful if you want to set up GCM for all
265+
users on a machine.
266+
267+
#### `unconfigure`
268+
269+
This command essentially undoes what the `configure` command does. It will check
270+
your Git configuration for the lines added by the `configure` command and remove
271+
them. The `unconfigure` command is run by the uninstaller for Windows and the
272+
uninstall script on macOS.
273+
274+
On Windows, if run with the `--system` option, the `unconfigure` command will
275+
also ensure that the `credential.helper` setting in the system Git configuration
276+
is not removed and is left as `manager`, the default set by Git for Windows.
277+
233278
[autodetect]: autodetect.md
234279
[azure-ssh]: https://docs.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate?view=azure-devops
235280
[bitbucket-ssh]: https://confluence.atlassian.com/bitbucket/ssh-keys-935365775.html
@@ -251,6 +296,7 @@ initiate this flow for you next time access is requested).
251296
[gitlab-apps]: https://gitlab.com/-/profile/applications
252297
[gitlab-oauthapp-revoke]: ./img/gitlab-oauthapp-revoke.png
253298
[gitlab-oauthapp-revoked]: ./img/gitlab-oauthapp-revoked.png
299+
[helper-config-docs]: https://git-scm.com/docs/gitcredentials#Documentation/gitcredentials.txt-helper
254300
[multiple-users]: multiple-users.md
255301
[netconfig-http-proxy]: netconfig.md#http-proxy
256302
[linux-uninstall-from-src]: ./linux-fromsrc-uninstall.md

‎docs/img/msa-confirm.png

77.5 KB
Loading

‎docs/img/msa-remove.png

146 KB
Loading

‎docs/install.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,21 @@ you have installed this using Homebrew, this installation will be unlinked
1414
#### Install
1515

1616
```shell
17-
brew tap microsoft/git
18-
brew install --cask git-credential-manager-core
17+
brew install --cask git-credential-manager
1918
```
2019

2120
After installing you can stay up-to-date with new releases by running:
2221

2322
```shell
24-
brew upgrade git-credential-manager-core
23+
brew upgrade --cask git-credential-manager
2524
```
2625

2726
#### Uninstall
2827

2928
To uninstall, run the following:
3029

3130
```shell
32-
brew uninstall --cask git-credential-manager-core
31+
brew uninstall --cask git-credential-manager
3332
```
3433

3534
---

‎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`

‎docs/rename.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,23 @@ At the time, the actual exectuable name was not updated and continued to be
1111
`git-credential-manager-core`. As of [2.0.877][rename-ver], the executable has
1212
been renamed to `git-credential-manager`, matching the new project name.
1313

14+
---
15+
16+
:warning: **Update:** :warning:
17+
18+
As of [2.3.0][no-symlink-ver] the `git-credential-manager-core` symlinks have been
19+
removed.
20+
21+
If you have not updated your configuration you will see error messages similar to:
22+
23+
```console
24+
git: 'credential-manager-core' is not a git command. See 'git --help'.
25+
```
26+
27+
To fix your configuration, please follow the [instructions][instructions] below.
28+
29+
---
30+
1431
## Rename transition
1532

1633
If you continue to use the `git-credential-manager-core` executable name you may
@@ -35,7 +52,7 @@ name as soon as possible to prevent any issues in the future.
3552
### Git for Windows
3653

3754
If you are using GCM bundled with Git for Windows (recommended), you should make
38-
sure you have updated to at least version WINGIT_VERSION.
55+
sure you have updated to the latest version.
3956

4057
[Download the latest Git for Windows ⬇️][git-windows]
4158

@@ -164,3 +181,5 @@ or `manager` respectively.
164181
[gcm-latest]: https://aka.ms/gcm/latest
165182
[warnings]: #rename-transition
166183
[win-standalone-instr]: ../README.md#standalone-installation
184+
[instructions]: #how-to-update
185+
[no-symlink-ver]: https://github.com/git-ecosystem/git-credential-manager/releases/tag/v2.3.0

‎docs/windows-broker.md

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ your machine: requiring certain kinds of sign-in, turning on antivirus and
8686
firewall software, and enabling BitLocker.
8787
Your identity will also be available to other apps on the computer for signing
8888
in, some of which may do so automatically.
89+
8990
![Example of policies pushed to an Intune-enrolled device][aad-bitlocker]
91+
9092
- If you uncheck "allow my organization to manage my device" and click "OK",
9193
your computer will be registered with Azure AD but will not be MDM-enrolled.
9294
Your identity will be available to other apps on the computer for signing in.
@@ -95,6 +97,7 @@ organization to manage your device. Despite joining Azure AD, your
9597
organization's Conditional Access policies may still prevent you from accessing
9698
Azure DevOps.
9799
If so, you'll be prompted with instructions on how to enroll in MDM.
100+
98101
- If you instead click "No, sign in to this app only", your machine will not be
99102
joined to Azure AD or MDM-enrolled, so no policies can be enforced, and your
100103
identity won't be made available to other apps on the computer.
@@ -132,27 +135,48 @@ improve over time and a "personal account" option to be presented in the future.
132135

133136
If you've connected your MSA to Windows or signed-in to other Microsoft
134137
applications such as Office, then you may see this account listed in the
135-
authentication prompts when using GCM. For any connected MSA, you can control
136-
whether or not the account is available to other Microsoft applications in
137-
**Settings**, **Accounts**, **Emails & accounts**:
138+
authentication prompts when using GCM.
139+
140+
---
141+
142+
⚠️ **Important** ⚠️
143+
144+
When adding a new MSA to Windows, you'll be asked to select whether to use this
145+
account across all of your device (**option 1**), or only permit Microsoft-apps
146+
to access your identity (**option 2**). If you opt to use the account everywhere,
147+
then your local Windows user account will be connected to that MSA.
148+
This means you'll need to use your MSA credentials to sign in to Windows going
149+
forward.
150+
151+
Selecting "just this app" or "Microsoft apps only" will still allow you to use
152+
this MSA across apps in Windows, but will not require you to use your MSA
153+
credentials to sign in to Windows.
154+
155+
![Confirmation to connect your MSA to Windows][msa-confirm]
156+
157+
To disconnect an MSA added using option 1, you can go into **Settings**,
158+
**Accounts**, **Your info** and click **Stop signing in to all Microsoft apps
159+
automatically**.
160+
161+
![Remove your Microsoft account from Windows][msa-remove]
162+
163+
For MSAs added for "Microsoft apps only", you can modify whether or not these
164+
accounts are available to other applications, and also remove the accounts from
165+
**Settings**, **Accounts**, **Emails & accounts**:
138166

139167
![Allow all Microsoft apps to access your identity][all-ms-apps]
140168

141169
![Microsoft apps must ask to access your identity][apps-must-ask]
142170

143-
Two very important things to note:
171+
## Running as administrator
144172

145-
- If you haven't connected any Microsoft accounts to Windows before, the first
146-
account you connect will cause the local Windows user account to be converted to
147-
a connected account.
148-
- In addition, you can't change the usage preference for the first Microsoft
149-
account connected to Windows: all Microsoft apps will be able to sign you in
150-
with that account.
173+
### GCM 2.1 and later
151174

152-
As far as we can tell, there are no workarounds for either of these behaviors
153-
(other than to not use the WAM broker).
175+
From version 2.1 onwards, GCM uses a version of the [Microsoft Authentication
176+
Library (MSAL)][msal-dotnet] that supports use of the Windows
177+
broker from an elevated process.
154178

155-
## Running as administrator
179+
### Previous versions
156180

157181
The Windows broker ("WAM") makes heavy use of [COM][ms-com], a remote procedure
158182
call (RPC) technology built into Windows. In order to integrate with WAM, Git
@@ -181,8 +205,10 @@ See https://aka.ms/gcm/wamadmin for more information.
181205

182206
In order to fix the problem, there are a few options:
183207

184-
1. Run Git or Git Credential Manager from non-elevated processes.
185-
2. Disable the broker by setting the
208+
1. Update to the [latest Git for Windows][git-for-windows-latest]
209+
**(recommended)**.
210+
2. Run Git or Git Credential Manager from non-elevated processes.
211+
3. Disable the broker by setting the
186212
[`GCM_MSAUTH_USEBROKER`][GCM_MSAUTH_USEBROKER]
187213
environment variable or the
188214
[`credential.msauthUseBroker`][credential.msauthUseBroker]
@@ -204,5 +230,8 @@ In order to fix the problem, there are a few options:
204230
[all-ms-apps]: img/all-microsoft.png
205231
[apps-must-ask]: img/apps-must-ask.png
206232
[ms-com]: https://docs.microsoft.com/en-us/windows/win32/com/the-component-object-model
233+
[msa-confirm]: img/msa-confirm.png
234+
[msa-remove]: img/msa-remove.png
207235
[msal-dotnet]: https://aka.ms/msal-net
208236
[devbox]: https://azure.microsoft.com/en-us/products/dev-box
237+
[git-for-windows-latest]: https://git-scm.com/download/win

‎src/osx/Installer.Mac/resources/en.lproj/conclusion.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ <h2>Uninstall</h2>
3434
<h2>Resources</h3>
3535
<ul>
3636
<li><a href="https://aka.ms/gcm">Project homepage</a></li>
37+
<li><a href="https://aka.ms/gcm/faq">Frequently asked questions</a></li>
3738
<li><a href="https://aka.ms/gcm/config">Configuration options</a></li>
3839
</ul>
3940
</div>

‎src/osx/Installer.Mac/resources/en.lproj/welcome.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ <h2>Installation notes</h2>
2828
<h2>Learn more</h2>
2929
<ul>
3030
<li><a href="https://aka.ms/gcm">Project homepage</a></li>
31+
<li><a href="https://aka.ms/gcm/faq">Frequently asked questions</a></li>
3132
</ul>
3233
</div>
3334
</body>

‎src/shared/Core/Interop/Linux/SecretServiceCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public SecretServiceCollection(string @namespace)
3939

4040
public IList<string> GetAccounts(string service)
4141
{
42-
return Enumerate(service, null).Select(x => x.Account).ToList();
42+
return Enumerate(service, null).Select(x => x.Account).Distinct().ToList();
4343
}
4444

4545
public ICredential Get(string service, string account)

‎src/shared/Core/Interop/MacOS/MacOSKeychain.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ public IList<string> GetAccounts(string service)
6666
if (typeId == CFArrayGetTypeID())
6767
{
6868
int len = (int)CFArrayGetCount(resultPtr);
69-
var accounts = new List<string>(len);
69+
var accounts = new HashSet<string>(len);
7070
for (int i = 0; i < len; i++)
7171
{
7272
IntPtr dict = CFArrayGetValueAtIndex(resultPtr, i);
7373
string account = GetStringAttribute(dict, kSecAttrAccount);
7474
accounts.Add(account);
7575
}
7676

77-
return accounts;
77+
return accounts.ToList();
7878
}
7979

8080
throw new InteropException($"Unknown keychain search result type CFTypeID: {typeId}.", -1);

‎src/shared/Core/Interop/Windows/WindowsCredentialManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public WindowsCredentialManager(string @namespace = null)
2626

2727
public IList<string> GetAccounts(string service)
2828
{
29-
return Enumerate(service, null).Select(x => x.UserName).ToList();
29+
return Enumerate(service, null).Select(x => x.UserName).Distinct().ToList();
3030
}
3131

3232
public ICredential Get(string service, string account)

‎src/shared/Core/PlaintextCredentialStore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public PlaintextCredentialStore(IFileSystem fileSystem, string storeRoot, string
2525

2626
public IList<string> GetAccounts(string service)
2727
{
28-
return Enumerate(service, null).Select(x => x.Account).ToList();
28+
return Enumerate(service, null).Select(x => x.Account).Distinct().ToList();
2929
}
3030

3131
public ICredential Get(string service, string account)

‎src/shared/TestInfrastructure/Objects/TestCredentialStore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public TestCredentialStore()
1616

1717
public IList<string> GetAccounts(string service)
1818
{
19-
return Query(service, null).Select(x => x.Account).ToList();
19+
return Query(service, null).Select(x => x.Account).Distinct().ToList();
2020
}
2121

2222
ICredential ICredentialStore.Get(string service, string account)

0 commit comments

Comments
 (0)
Please sign in to comment.