从私人git克隆流浪者条款?

时间:2016-06-06 18:37:29

标签: git vagrant

我想在配置基于Linux的Vagrant盒子时从bitbucket中的私有项目中检索项目,但我正在运行它是失败的。

该操作的形式为:

cd /tmp

git clone ssh://git@bitbucket.org/myuser/myproject.git

在我的Vagrant文​​件中,我指定了:

 config.ssh.forward_agent = true

操作的输出是:

==> default: Cloning into 'myproject'...
==> default: Host key verification failed.
==> default: fatal: Could not read from remote repository.
==> default: 
==> default: Please make sure you have the correct access rights
==> default: and the repository exists.

如果我vagrant ssh进入框中然后尝试相同的git克隆,我就没有问题克隆存储库。

我尝试添加以下内容(其中“ubuntu”是框“ubuntu / xenial64”的默认用户):

sudo -H -u ubuntu ssh-keygen -R bitbucket.org
sudo -H -u ubuntu git clone ssh://git@bitbucket.org/myuser/myproject.git

这只会导致:

==> default: Host bitbucket.org not found in /home/ubuntu/.ssh/known_hosts
==> default: Cloning into 'myproject'...
==> default: Host key verification failed.
==> default: fatal: Could not read from remote repository.
==> default: 
==> default: Please make sure you have the correct access rights
==> default: and the repository exists.

我也尝试将以下内容添加到脚本中,但没有更改:

ssh-keyscan -H bitbucket.com >> ~/.ssh/known_hosts
sudo -H -u ubuntu ssh-keyscan -H bitbucket.com >> ~/.ssh/known_hosts

流浪汉配置:

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "ubuntu/xenial64"

  config.vm.synced_folder './', '/vagrant', disabled: false, create: true

  config.ssh.forward_agent = true

  config.vm.provider :virtualbox do |vb, override|
    vb.name = 'myproject-dev-standalone'    

    # Web server HTTP front end
    override.vm.network :forwarded_port, guest: 80, host: 10080
    # Web server HTTPS front end    
    override.vm.network :forwarded_port, guest: 443, host: 10443

    override.vm.provision :shell do |s|
      s.path = "provision/install.sh"
      s.privileged = false
    end
  end

end

在没有将密码硬编码到安装脚本中的情况下,任何人都可以建议在配置期间能够git clone吗?

0 个答案:

没有答案