Skip to content
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

git::repo does not update remote URL if it changes. #7

Open
Aethylred opened this issue Mar 5, 2013 · 2 comments
Open

git::repo does not update remote URL if it changes. #7

Aethylred opened this issue Mar 5, 2013 · 2 comments
Assignees

Comments

@Aethylred
Copy link
Member

If you change a git::repo source parameter, e.g.

git::repo{'foo':
  path    => '/usr/src/foo,
  source  => 'git://github.com/me/foo.git',
}

to

git::repo{'foo':
  path    => '/usr/src/foo,
  source  => 'git://github.com/you/foo.git',
}

And does nothing.

While doing the same and changing the branch (iff the new branch does not exist on the old remote):

git::repo{'foo':
  path    => '/usr/src/foo,
  source  => 'git://github.com/me/foo.git',
  branch  => 'master',
}

to

git::repo{'foo':
  path    => '/usr/src/foo,
  source  => 'git://github.com/you/foo.git',
  branch  => 'baa',
}

results in the error:

Error: /usr/bin/git checkout baa returned 1 instead of one of [0]
Error: /Stage[main]/Puppetdashboard::Install/Git::Repo[puppet-dashboard]/Exec[git_puppet-dashboard_co_branch]/returns: change from notrun to 0 failed: /usr/bin/git checkout baa returned 1 instead of one of [0]

...well because the baa branch doesn't exist.

@ghost ghost assigned Aethylred Mar 5, 2013
@Aethylred
Copy link
Member Author

A workaround is to either delete the repository on the target server and have puppet recreate it on the next run, or manually change the remote to a new URL with:

git remote set-url origin 'git:/example.org/path/to/repo.git' -b branch
git fetch origin
git reset --hard origin/branch

@buddhistpirate
Copy link

Ran into this as well.
I think the 'set-url' could be called if the current url does not match the source provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants