You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to execute any command by using the execute() method (e.g. git.Git.execute("git config --global --list") or git.Git.execute(command="git config --global --list")), this is the output I get:
You can manually instantiate a Git command like so.
I was searching a way to manage the git config --global without having a repo setup. In particular, before cloning a repo I need to ensure that the global proxy settings are correctly placed in the config list (git config --global http.proxy, otherwise all the fetch/clone commands will fail), but apparently I cannot execute any git command if I do not either have a repo set up or a repo initialized.
A workaround could be to initialize a dummy empty repo which I can use to execute the global config commands, and then delete it. But it's a dirty solution... Do you have better ideas?
git_dir can be any existing directory, it is the working directory of the git command when spawned. This doesn't need to be a repository.
Maybe try it with the invocation you need.
Activity
[-]git.Git.execute() does not work[/-][+]git.Git.execute() does not work in v3.1.11[/+]Byron commentedon Nov 18, 2020
I recommend reading the docs on how to use git directly to resolve this issue. The problem is trying to use an instance method as a class method.
zm0n3 commentedon Nov 18, 2020
Thanks Byron for pointing me the doc. So if I have to change the git global config, there's nothing I can do, am I correct?
Byron commentedon Nov 19, 2020
You can manually instantiate a
Gitcommand like so.zm0n3 commentedon Nov 19, 2020
I was searching a way to manage the git config --global without having a repo setup. In particular, before cloning a repo I need to ensure that the global proxy settings are correctly placed in the config list (
git config --global http.proxy, otherwise all the fetch/clone commands will fail), but apparently I cannot execute any git command if I do not either have a repo set up or a repo initialized.A workaround could be to initialize a dummy empty repo which I can use to execute the global config commands, and then delete it. But it's a dirty solution... Do you have better ideas?
Thanks in advance
Byron commentedon Nov 19, 2020
git_dircan be any existing directory, it is the working directory of the git command when spawned. This doesn't need to be a repository.Maybe try it with the invocation you need.