我想在配置基于 Linux 的 Vagrant 框时从 bitbucket 中的私有项目中检索项目,但我正在运行此操作失败。
操作的形式为:
cd /tmp
git clone ssh://git@bitbucket.org/myuser/myproject.git
Run Code Online (Sandbox Code Playgroud)
在我的 Vagrant 文件中,我指定了:
config.ssh.forward_agent = true
Run Code Online (Sandbox Code Playgroud)
操作的输出是:
==> 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.
Run Code Online (Sandbox Code Playgroud)
如果我vagrant ssh进入盒子然后尝试相同的 git clone 我在克隆存储库时没有问题。
我尝试添加以下内容(其中“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
Run Code Online (Sandbox Code Playgroud)
这只会导致:
==> 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.
Run Code Online (Sandbox Code Playgroud)
我还尝试将以下内容添加到脚本中,但没有任何变化:
ssh-keyscan -H bitbucket.com >> ~/.ssh/known_hosts
sudo -H -u ubuntu ssh-keyscan -H bitbucket.com >> ~/.ssh/known_hosts
Run Code Online (Sandbox Code Playgroud)
流浪者配置:
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
Run Code Online (Sandbox Code Playgroud)
任何人都可以建议git clone在配置期间无需将密码硬编码到安装脚本中的方法吗?
| 归档时间: |
|
| 查看次数: |
2186 次 |
| 最近记录: |