libgit2sharp
libgit2sharp copied to clipboard
[Question] Is there a way to add safe.directory '*' via libgit2
I want to avoid executing commands and updating files manually. Is there an existing API within libgit2 that replace this command => git config --global --add safe.directory '*'
Hi, Is there an issue with using Repository.Config
of Configuration
type. Specifically Set<>
family of methods?
From the top of my head your call would look like:
repostiory.Config.Set("save.directory", "*");
Or am I missing something?
Be advised that I haven't used the library yet and I am just getting familiar with the API - hoping to use it in a following months.
Hi, Is there an issue with using
Repository.Config
ofConfiguration
type. SpecificallySet<>
family of methods? From the top of my head your call would look like:repostiory.Config.Set("save.directory", "*");
Or am I missing something? Be advised that I haven't used the library yet and I am just getting familiar with the API - hoping to use it in a following months.
Yes. I get the error "repository path .... is not owned by current user" when i try to create the repository with:
new Repository(workRepoPath)
That is the reason why i want to add the save directory option.
Hi,
you would need any local repository, which you can access, and create a configuration for this one.
With this configuration instance, you are able to change global settings.
For Example, if you have an existing local repository under LocalPath
, then you could do the following:
Configuration.BuildFrom(LocalPath).Add("safe.directory", "*", ConfigurationLevel.Global)
This would set the same global configuration value as: git config --global --add safe.directory '*'