我正在使用 puppet 在代理节点上克隆 repo。我的 site.pp 包含
node foobar{
vcsrepo{"home/user1/gitrepo1":
provider=>git,
source=>"https://github.com/foobar/foo.git",
revision => "remotes/origin/bar",
}
}
git branch
在应用目录后,我在代理上执行的操作显示
*(no branch)
master
当我git branch -a
这样做时它显示
master
remotes/origin/HEAD -> origin/master
remotes/origin/bar
我希望能够签出远程“bar”分支。仅指定revision=>bar
会产生以下错误。文档对此也不太清楚。
err: /Stage[main]//Node[foobar]/Vcsrepo[/home/user1/gitrepo1]: Could not evaluate: Execution of '/usr/bin/git rev-parse bar' returned 128: fatal: ambiguous argument 'bar': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
bar
编辑:我最初发布的内容中有拼写错误。事实上,我在 site.pp 中指定了 revision=>bar
谢谢。
答案1
可以使用“修订”来指定分支(可以是提交 SHA、标签或分支名称):
vcsrepo { "/path/to/repo":
ensure => present,
provider => git,
source => 'git://example.com/repo.git',
revision => '0c466b8a5a45f6cd7de82c08df2fb4ce1e920a31'
}
vcsrepo { "/path/to/repo":
ensure => present,
provider => git,
source => 'git://example.com/repo.git',
revision => '1.1.2rc1'
}
vcsrepo { "/path/to/repo":
ensure => present,
provider => git,
source => 'git://example.com/repo.git',
revision => 'development'
}
https://github.com/puppetlabs/puppetlabs-vcsrepo/blob/master/README.GIT.markdown