Skip to content
  • Sponsor
  • Notifications You must be signed in to change notification settings
  • Fork 954

Incorrectly placed kwargs in git-remote wrapper #262

@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.

Activity

added this to the v0.3.7 - Fixes milestone on Feb 21, 2015
Byron

Byron commented on Feb 21, 2015

@Byron
Member

In the meanwhile, you should be able to workaround the issue by using git directly:

repo.git.remote('add', '--mirror=push', 'ro_copy', repo_copy)
my_new_remote = repo.remotes.ro_copy
self-assigned this
on Feb 21, 2015
Byron

Byron commented on Feb 21, 2015

@Byron
Member

You can watch me fixing this on youtube.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Incorrectly placed kwargs in git-remote wrapper · Issue #262 · gitpython-developers/GitPython