Ansible Equivalent of git remote set-url origin

Viewed 771

I'm trying to update a git repositories origin with Ansible. The command I'm trying to mimic is git remote set-url origin new.git.url/here. Does anyone know how I can accomplish this? I'm trying to do it without recloning the repository.

1 Answers

See git_config. For example, given the Git repository test.git

shell> git init --bare  test.git

The playbook below does the job

- hosts: localhost
  tasks:
    - git_config:
        repo: 'test.git'
        scope: 'local'
        name: 'remote.origin.url'
        value: 'new.git.url/here'
shell> cd test.git && git config remote.origin.url
new.git.url/here
Related