Skip to content

git.Git.execute() does not work in v3.1.11 #1086

Description

@zm0n3

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:

*** TypeError: execute() missing 1 required positional argument: 'self'

Is this a bug?

Activity

  1. changed the title [-]git.Git.execute() does not work[/-] [+]git.Git.execute() does not work in v3.1.11[/+] on Nov 18, 2020
  2. Byron commented on Nov 18, 2020

    @Byron
    Member

    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.

  3. zm0n3 commented on Nov 18, 2020

    @zm0n3
    Author

    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.

    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?

  4. Byron commented on Nov 19, 2020

    @Byron
    Member

    You can manually instantiate a Git command like so.

  5. zm0n3 commented on Nov 19, 2020

    @zm0n3
    Author

    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?

    Thanks in advance

  6. Byron commented on Nov 19, 2020

    @Byron
    Member
    g = Git( git_dir )
    rval = g.config(…)       

    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.

  7. reopened this on Feb 26, 2021
  8. locked and limited conversation to collaborators on Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions