Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit f981958

Browse files
We can only set wincred after the correct git path is set
1 parent fc7ec97 commit f981958

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/GitHub.Api/ApplicationManagerBase.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,25 @@ private async Task RunInternal()
119119
logger.Trace("Environment.GitExecutablePath \"{0}\" Exists:{1}", gitSetup.GitExecutablePath, gitSetup.GitExecutablePath.FileExists());
120120

121121
await RestartRepository();
122-
}
122+
123+
string credentialHelper = null;
124+
var gitConfigGetTask = new GitConfigGetTask(Environment, ProcessManager,
125+
new TaskResultDispatcher<string>(s => {
126+
credentialHelper = s;
127+
}), "credential.helper", GitConfigSource.Global);
123128

124129

130+
await gitConfigGetTask.RunAsync(CancellationToken.None);
131+
132+
if (credentialHelper != "wincred")
133+
{
134+
var gitConfigSetTask = new GitConfigSetTask(Environment, ProcessManager,
135+
new TaskResultDispatcher<string>(s => { }), "credential.helper", "wincred",
136+
GitConfigSource.Global);
137+
138+
await gitConfigSetTask.RunAsync(CancellationToken.None);
139+
}
140+
}
125141

126142
private async Task<string> LookForGitInstallationPath()
127143
{

src/GitHub.Api/GitSetup.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ public async Task<bool> SetupIfNeeded(IProgress<float> percentage = null, IProgr
2626
{
2727
var setupIfNeeded = await gitInstaller.SetupIfNeeded(percentage, timeRemaining);
2828

29-
var gitConfigGetTask = new GitConfigGetTask(environment, processManager,
30-
new TaskResultDispatcher<string>(s => { }), "credential.helper",
31-
GitConfigSource.Global);
32-
3329
return setupIfNeeded;
3430
}
3531

0 commit comments

Comments
 (0)