Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to pull a git (github) repo via Puppet. I've used the official vcsrepo documentation and borrowed from the Fiesta post to come up with the following config:

vcsrepo { "/tmp/":
  ensure => latest,
  provider => git,
  source => '',
  revision => 'master',
  # eventually:
  # revision => 'branchname'
  require => [ Package["git"], Sshkey[""] ],
  identity => '/home/ubuntu/.ssh/id_rsa',

The problem is, when I run this, I get the following output. I've chopped most of the logging related to the Package and Sshkey, as they appear to be fine:

$ sudo puppet apply --debug --verbose /etc/puppet/modules/github-deploy/manifests/init.pp
[snip lots of output]
debug: Puppet::Type::Package::ProviderApt: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} ${Version}\n''
debug: Puppet::Type::Package::ProviderApt: Executing '/usr/bin/apt-cache policy git'
debug: Prefetching parsed resources for sshkey
notice: /Stage[main]/Github_deploy/Vcsrepo[/tmp/]/ensure: Creating repository from latest
err: /Stage[main]/Github_deploy/Vcsrepo[/tmp/]/ensure: change from absent to latest failed: Could not create repository (non-repository at path)
[snip some output]

This appears to be the same as in this bug, though the pull request is either a 404 or inaccessible, so I don't know what version contains the fix. (it says "pending release", admittedly) There's also the following discussion, but it links to an invalid bug ID too.

There's also a postscript on the vcsrepo doc that says "use require" and "see /examples/", but there aren't any substantial examples. Sigh.

For what it's worth, I tried "ensure bare" instead. Doesn't work (same error). Note that neither "ensure bare" or "ensure latest" give the command that is being run in the logs. I don't know if that is a problem.

So, is the answer that git-via-ssh doesn't work? How do I pull a private repo from github? I'm loath to use exec if I can avoid it, but maybe that's the answer.

If the answer is "use https instead", how does that work for authenticated repos on github? Simply saying "you can't use git-via-ssh with the current version of vcsrepo" is not a sufficient answer.

FWIW, I'm using 2.7 of puppet:

$ puppet --version
share|improve this question
up vote 1 down vote accepted

Looks like the problem is that you're giving it a path of "/tmp/" - the error is saying that something already exists at the path which is supposed to be the repository (the /tmp directory), and that it's not going to proceed because of that.

Did you intend to clone to something like "/tmp/reponame" instead?

share|improve this answer
I tried "mkdir /tmp/gittest", gave the path as /tmp/gittest, then tried applying with ensure=>latest then ensure=>bare. Same "could not create repository" error. I then removed the dir gittest and it works. So yes, the problem is you can't use a directory that exists. – tedder42 Jan 12 '13 at 21:24

You can use the parameter force in vcsrepo, which will delete everything and recreate it for you.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.