Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Incorrectly placed kwargs in git-remote wrapper #262

Closed
@tkemmer

Description

@tkemmer

I encountered an error while trying to use kwargs with git.repo.base.Repo.create_remote(). As can be seen in the output below, the kwargs are inserted into the git remote add command bit, more specifically, before the add sub-command, rather than appended to it, which git does not seem to like.

  File "webhook.py", line 44, in do_POST
    conf_parser = rep.create_remote('rocopy', repo_copy, mirror='push').config_writer
  File "/usr/lib64/python2.7/site-packages/git/repo/base.py", line 353, in create_remote
    return Remote.create(self, name, url, **kwargs)
  File "/usr/lib64/python2.7/site-packages/git/remote.py", line 480, in create
    repo.git.remote("add", name, url, **kwargs)
  File "/usr/lib64/python2.7/site-packages/git/cmd.py", line 431, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/git/cmd.py", line 802, in _call_process
    return self.execute(make_call(), **_kwargs)
  File "/usr/lib64/python2.7/site-packages/git/cmd.py", line 607, in execute
    raise GitCommandError(command, status, stderr_value)
GitCommandError: 'git remote --mirror=push add rocopy github:tkemmer/test' returned with exit code 129
stderr: 'error: unknown option `mirror=push'
usage: git remote [-v | --verbose]
   or: git remote add [-t <branch>] [-m <master>] [-f] [--tags|--no-tags] [--mirror=<fetch|push>] <name> <url>
   or: git remote rename <old> <new>
   or: git remote remove <name>
   or: git remote set-head <name> (-a | --auto | -d | --delete |<branch>)
   or: git remote [-v | --verbose] show [-n] <name>
   or: git remote prune [-n | --dry-run] <name>
   or: git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]
   or: git remote set-branches [--add] <name> <branch>...
   or: git remote set-url [--push] <name> <newurl> [<oldurl>]
   or: git remote set-url --add <name> <newurl>
   or: git remote set-url --delete <name> <url>

    -v, --verbose         be verbose; must be placed before a subcommand
'
----------------------------------------

I'm currently using GitPython v0.3.6 and Git v2.0.5.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions