我正在尝试使用ansible和vagrant设置开发环境。现在我坚持从bitbucket克隆git repo。ansible git clone权限被拒绝问题
下面是Vagrantfile和可靠的设置以及我尝试过的东西。
在我Vagrantfile我有config.ssh.forward_agent = true
在我deploy.yml我上面
- name: ensure bitbucket is a known host
lineinfile:
dest: /home/vagrant/.ssh/known_hosts
create: yes
state: present
line: "{{ lookup('pipe', 'ssh-keyscan -p 443 -t rsa altssh.bitbucket.org') }}"
regexp: "^altssh\\.bitbucket\\.org"
sudo_user: "vagrant"
tags: known_hosts
- name: checkout opentest repo
git: >
dest="/home/vagrant/ot/"
repo="ssh://[email protected]:443/muhammadammar/opentest/"
version="master"
accept_hostkey=yes
sudo_user: "vagrant"
tags: checkout
第一任务添加到位桶的公钥到/home/vagrant/.ssh/known_hosts
。
下面是输出的时候ansible尝试签回购
<127.0.0.1> ESTABLISH CONNECTION FOR USER: vagrant
<127.0.0.1> REMOTE_MODULE git dest="/home/vagrant/ot/" repo="ssh:********@altssh.bitbucket.org:443/muhammadammar/opentest/" version=master accept_hostkey=yes
<127.0.0.1> EXEC ssh -C -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/ammar/.ansible/cp/%h-%r" -o StrictHostKeyChecking=no -o Port=2222 -o IdentityFile="/Users/ammar/.vagrant.d/insecure_private_key" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 127.0.0.1 /bin/sh -c 'sudo -k && sudo -HE -S -p "[sudo via ansible, key=vwkfotuvzzmllxvxptkgehjzdlqygoez] password: " -u vagrant /bin/sh -c '"'"'echo BECOME-SUCCESS-vwkfotuvzzmllxvxptkgehjzdlqygoez; LANG=C LC_CTYPE=C /usr/bin/python'"'"''
failed: [default] => {"cmd": "/usr/bin/git ls-remote 'ssh:********@altssh.bitbucket.org:443/muhammadammar/opentest/' -h refs/heads/master", "failed": true, "rc": 128}
stderr: RSA host key for IP address '131.103.20.174' not in list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
msg: RSA host key for IP address '131.103.20.174' not in list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
FATAL: all hosts have already failed -- aborting
to retry, use: --limit @/Users/ammar/dev.retry
default : ok=1 changed=0 unreachable=0 failed=1
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
在我主我已经加了我的私钥的SSH认证代理。我可以在主机和流浪盒上看到使用ssh-add -l
的私钥身份。
在颠沛流离的盒子,我可以成功地克隆使用git clone ssh://[email protected]:443/muhammadammar/opentest ot
我不知道是什么问题回购。任何人都可以帮助解决这个问题。
编辑
即使下面不ansible
shell: "git clone ssh://[email protected]:443/muhammadammar/opentest/ /home/vagrant/omp/"
您是否尝试了http://stackoverflow.com/a/30775053/4296747的建议? –
@FrédéricHenri无法正常工作 – MA1