1

I am learning C# and trying to develop a git client, currently using the library: libgit2sharp,

Now I have a requirement to display and support modification of git global config, such as "user.name" or "user.email".

bug I did not find the corresponding documentation in the official wiki

One more question, I am running the program on a Windows Arm64 device and libgit2sharp doesn't seem to support it, is that true?

Windows Arm64 Error Image: enter image description here

3
  • One more question, I am running the program on a Windows Arm64 device and libgit2sharp doesn't seem to support it, is that true Commented Jan 11, 2023 at 7:03
  • You should add your comment into your question. And yes, it's very possible that some library doesn't support Arm64. But a Windows Arm64 machine can support x86 or x64 code. Commented Jan 11, 2023 at 8:26
  • This issue on the GitHub repo might help you. Commented Jan 12, 2023 at 0:21

1 Answer 1

0

It seems that there is no API to get or set git config using LibGit2Sharp. However, I was able to do it by simply starting git process with correct arguments:

var startInfo = new ProcessStartInfo
{
    FileName = "git",
    Arguments = "config --global user.email [email protected]",
    RedirectStandardOutput = true,
    RedirectStandardError = true,
    UseShellExecute = false,
    CreateNoWindow = true,
    WorkingDirectory = "."
};

var process = new Process { StartInfo = startInfo };
process.Start();
process.WaitForExit();

if (process.ExitCode != 0)
{
    throw new InvalidOperationException($"Process exited with non-zero code ({process.ExitCode}).");
}

In regards to running it on a Windows Arm64 device I was at least able to build a project with LibGit2Sharp as dependency using win-arm64 runtime flag:

dotnet build -r win-arm64

And during my quick research I've also found this article, that seems to prove it is possible to run .NET 8 apps on Arm64 machine. If I were you I would check if .NET SDK is correctly installed on the machine.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.