2
我不能強迫vagrant配置從bitbucket克隆私人git repos。我有流浪者1.6.3。流浪外殼和可靠的配置失敗bitbucket
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.private_key_path = "~/.vagrant.d/insecure_private_key"
config.ssh.forward_agent = true
config.vm.define "abox" do |abox|
abox.vm.box = "ubuntu/trusty32"
abox.vm.hostname = "abox"
abox.ssh.forward_agent = true
abox.vm.network "private_network", ip: "192.168.50.4"
abox.vm.network "forwarded_port", guest: 22, host: 2233
abox.vm.network "forwarded_port", guest: 6340, host: 6340
abox.vm.network "forwarded_port", guest: 8080, host: 6388
abox.vm.provision :shell,
:path => "provisioning/ssh_keys.sh", :privileged => false
abox.vm.provision :shell,
:path => "provisioning/setup_project.sh"
end
end
凡ssh_keys我:
function create_key() {
ssh-add -L >> ~/.ssh/authorized_keys
ssh-keyscan -t rsa 127.0.0.1 > ~/.ssh/known_hosts
}
create_key
然後在setup_project我打電話:
su - vagrant -c "ssh-keyscan bitbucket.org >> /home/vagrant/.ssh/known_hosts && \
ssh-keyscan github.com >> /home/vagrant/.ssh/known_hosts"
echo 'Clone bitbucket repo'
su - vagrant -c "cd /vagrant && git clone [email protected]:someuser/some-project-that-i-have-access-to.git"
輸出是:
Permission denied (publickey).
==> abox: fatal: Could not read from remote repository.
==> abox:
==> abox: Please make sure you have the correct access rights
==> abox: and the repository exists.
Error: Error while executing git clone -q [email protected]:someuser/some-project-that-i-have-access-to.git localclone
然而,當我vagrant ssh
進盒子和th同時調用相同的git clone命令 - 一切正常。我也測試了可靠的配置,但問題完全一樣。
這裏有什麼問題?
你能解釋一下這更多一點? 我所做的是: 1.刪除'蘇 - 遊民-c 「命令」',只留'command' 2.運行'setup_project'有:priviledged =>假 現在,它的工作原理。我想這裏的問題與最初我以root用戶運行setup_project並將'su'運行給用戶'vagrant'的事實有關。 – eXt