Reputation: 12289
I am running Git version 2.12.1 on Windows Server 2012 R2 running against Microsoft Team Foundation Cloud Service. No matter what Git command I run I keep getting this same error. I have even opened my Firewall entirely to see if that was causing it but to no avail. I have tried Clone, Push, & Pull and they all return this error.
git clone https://myaccount.visualstudio.com/_git/myProject
Cloning into 'myProject'...
fatal: HttpRequestException encountered.
An error occurred while sending the request.
Unhandled Exception: System.ObjectDisposedException: Cannot access a closed file.
at System.IO.__Error.FileNotOpen()
at System.IO.FileStream.Flush(Boolean flushToDisk)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at Microsoft.Alm.Git.Trace.Microsoft.Alm.Git.ITrace.Flush()
at Microsoft.Alm.Cli.Program.Die(String message)
at Microsoft.Alm.Cli.Program.Die(Exception exception)
at Microsoft.Alm.Cli.Program.Main(String[] args)
Upvotes: 14
Views: 5176
Reputation: 1324063
This is a callstack from the Git Credential-Manager for Windows: see its issue 481.
This is a credential helper which will cache in the Windows Credential Manager store the password associated to an account and remote Git Hosting server URL.
Check the value of git config credential.helper
Normal resolution: upgrade Git (which embeds GCM).
In the off-chance a year-old file-related error is the by-produc of a GitHub SSL configuration change (made yesterday), the maintainer for Git for Windows just tweeted:
If you're having trouble connecting to GitHub from Windows today, please make sure to update to the latest version of Git for Windows.
GitHub changed their SSL configuration.
As a workaround (at least to confirm this is the issue), remove credential.helper from any git config setting file. See git config -l --show-origin
to list all of them.
Once removed, any clone, if it needs authentication, should prompt you for credentials. But at least, it would not fail.
Check also if the version of the GCM (Git Credential Manager -- for Windows) is the last one or not.
For that, check what Git version you are using.
Check where is your Git program installed: type in CMD session.
where git
Once you know where Git is installed, you can get to the GCM version embedded in Git:
C:\path\To\git
"./mingw64/libexec/git-core/git-credential-manager.exe" version
Git Credential Manager for Windows version 1.14.0
Upvotes: 6
Reputation: 121
According to this issue on the Git Credential Manager issue tracker and my own experience this morning, a HttpRequestException error with an exception of System.ObjectDisposedException: Cannot access a closed file with a repository that was previously working is likely due to the repository host rolling out TLS 1.2 as a requirement and you using a version of the Git Credential Manager before 1.14.0 (included with Git for Windows v2.16.2).
To solve, update to Git for Windows v2.16.2 or newer.
To address iagowp directly, if this is a repository hosted on Github, they started to force TLS 1.2 as of 19:00 UTC on the 22nd of Feb.
Upvotes: 7