Skip to content

Incorrectly placed kwargs in git-remote wrapper #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tkemmer opened this issue Feb 20, 2015 · 2 comments
Closed

Incorrectly placed kwargs in git-remote wrapper #262

tkemmer opened this issue Feb 20, 2015 · 2 comments
Assignees

Comments

@tkemmer
Copy link

tkemmer commented Feb 20, 2015

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.

@Byron Byron added this to the v0.3.7 - Fixes milestone Feb 21, 2015
@Byron
Copy link
Member

Byron commented Feb 21, 2015

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

@Byron Byron self-assigned this Feb 21, 2015
@Byron Byron closed this as completed in e0acb83 Feb 21, 2015
@Byron
Copy link
Member

Byron commented Feb 21, 2015

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
Development

No branches or pull requests

2 participants