我正在嘗試使用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