git-credential-manager icon indicating copy to clipboard operation
git-credential-manager copied to clipboard

dotnet tool install git-credential-manager

Open hickford opened this issue 3 years ago • 5 comments

There are several Linux distributions that support .NET but can’t install deb packages. Installing or updating Git Credential Manager on these platforms is discouragingly awkward -- you have to download the binaries, decompress and copy to the path. Even on Debian and Ubuntu which can install deb packages, updating GCM is a manual process.

It would thus be handy to additionally distribute Git Credential Manager as a dotnet global tool that could be installed dotnet tool install -g git-credential-manager. For users with .NET installed, this is a super convenient way to install. Updating is as simple as dotnet tool update --global git-credential-manager. An advantage on all platforms is that the framework-dependent install size (4.5 MB) is much much smaller than self-contained binaries (65 MB).

For applications developed in Python, Go or Nodejs, distributing via language package manager is a popular option offered among alternatives. For example, http client httpie can be installed from PyPI pip install httpie as well as Linux distribution package managers or Snap.

hickford avatar Aug 06 '22 11:08 hickford

Some observations:

  1. https://www.nuget.org/packages/Git-Credential-Manager/ is currently squatted by jetbrains, last updated 2020.
  2. A package can only contain at most one tool, so the UI helpers would have to be packaged separately, eg. dotnet tool install --global git-credential-manager-github-ui.

hickford avatar Aug 06 '22 14:08 hickford

  1. A package can only contain at most one tool

Curious - where did you find this information?

ldennington avatar Aug 23 '22 20:08 ldennington

If DotNetToolSettings.xml declares more than one command, then the tool will fail to install:

https://github.com/dotnet/sdk/blob/dc262f0c444d57181e580d4d5b9a517ea558c64a/src/Cli/dotnet/ToolPackage/ToolConfigurationDeserializer.cs#L53-L56

https://github.com/dotnet/sdk/blob/dc262f0c444d57181e580d4d5b9a517ea558c64a/documentation/general/tool-nuget-package-format.md#remark

However, I don't think there is any rule against including additional executable files that are not declared as tool commands.

KalleOlaviNiemitalo avatar Aug 26 '22 06:08 KalleOlaviNiemitalo

A package can only contain at most one tool executable installed to $HOME/.dotnet.tools, so the UI helpers would have to be packaged separately

Thinking further, perhaps everything could be packaged together, writing a custom nuspec. While only the git-credential-manager shim would be installed to $HOME/.dotnet/tools, all the assemblies including GitHub.UI etc would be installed to eg. .dotnet/tools/.store/git-credential-manager-core/2.0.799-gef7f88243b/git-credential-manager-core/2.0.799-gef7f88243b/tools/net6.0/any, so they would have no problem finding each other.

hickford avatar Aug 27 '22 11:08 hickford

A package can only contain at most one tool executable installed to $HOME/.dotnet.tools, so the UI helpers would have to be packaged separately

Thinking further, perhaps everything could be packaged together, writing a custom nuspec. While only the git-credential-manager shim would be installed to $HOME/.dotnet/tools, all the assemblies including GitHub.UI etc would be installed to eg. .dotnet/tools/.store/git-credential-manager-core/2.0.799-gef7f88243b/git-credential-manager-core/2.0.799-gef7f88243b/tools/net6.0/any, so they would have no problem finding each other.

Got an early version of this working today!

ldennington avatar Sep 20 '22 20:09 ldennington

@ldennington I'm squatting both https://www.nuget.org/packages/git-credential-manager-core/ and https://www.nuget.org/packages/git-credential-manager with unlisted prerelease packages so can add you as an package owner whenever you're ready to publish to https://nuget.org/

hickford avatar Oct 13 '22 04:10 hickford

@ldennington I'm squatting both https://www.nuget.org/packages/git-credential-manager-core/ and https://www.nuget.org/packages/git-credential-manager with unlisted prerelease packages so can add you as an package owner whenever you're ready to publish to https://nuget.org/

This is awesome! Thank you so much @hickford. Would you mind following these instructions to transfer both the git-credential-manager and the git-credential-manager-core packages to the git-credential-manager organization (you'll just specify git-credential-manager as the new owner name)?

ldennington avatar Oct 13 '22 18:10 ldennington

We're officially live on nuget.org 🥳

https://www.nuget.org/packages/git-credential-manager/2.0.877

ldennington avatar Nov 16 '22 20:11 ldennington