# how to solve it Ansible 2.9 git Permission denied (publickey).\\r\\nfatal: The remote end hung up unexpectedly

**URL:** <https://forum.ansible.com/t/how-to-solve-it-ansible-2-9-git-permission-denied-publickey-r-nfatal-the-remote-end-hung-up-unexpectedly/33004>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [May 22, 2020, 9:02am UTC](https://forum.ansible.com/t/how-to-solve-it-ansible-2-9-git-permission-denied-publickey-r-nfatal-the-remote-end-hung-up-unexpectedly/33004 "2020-05-22T09:02:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [May 22, 2020, 9:02am UTC](https://forum.ansible.com/t/how-to-solve-it-ansible-2-9-git-permission-denied-publickey-r-nfatal-the-remote-end-hung-up-unexpectedly/33004/1 "2020-05-22T09:02:24Z")

</div>

> Here is my ansible Version
> 
> \>  
> ansible 2.9.7
> 
> config file =/Users/jeongwookko/git/ansible.cfg
> 
> configured modulesearch path =['/Users/jeongwookko/.ansible/plugins/modules','/usr/share/ansible/plugins/modules']
> 
> ansible python modulelocation =/usr/local/Cellar/ansible/2.9.7/libexec/lib/python3.8/site-packages/ansible
> 
> executable location =/usr/local/bin/ansible
> 
> python version =3.8.2(default,Mar112020,00:29:50)[Clang11.0.0(clang-1100.0.33.17)]
> 
> \>
> 
> cat ansible.cfg
> 
> \>  
> [defaults]
> 
> deprecation\_warnings=False
> 
> hostfile =hosts/main
> 
> ask\_sudo\_pass =False
> 
> ask\_pass =True
> 
> pipelining =True
> 
> gatherging =True
> 
> poll\_interval=20
> 
> record\_host\_keys=False
> 
> fact\_caching\_timeout =86400
> 
> transport =ssh
> 
> forks=100
> 
> log\_path=ansible.log
> 
> poll\_intervals=20
> 
> display\_skipped\_hosts =False
> 
> host\_key\_checking =False
> 
> sudo\_flags =-HEs
> 
> [ssh\_connection]
> 
> ssh\_args=-o ForwardAgent=yes -o StrictHostKeyChecking=no-o UserKnownHostsFile=/dev/null-o LogLevel=ERROR -o  
> ConnectTimeout=120
> 
> scp\_if\_ssh=True
> 
> #ansible\_ssh\_private\_key\_file=.  
> \>
> 
> when ansible-playbook
> 
> \>
> 
> task path:/Users/jeongwookko/git/roles/site/symfony/tasks/main.yml
> 
> -git:repo=git@git.aaa.com:xxxxxxx version={{site\_branch }}dest={{site\_repo\_root }}accept\_hostkey=yes force=no
> 
> -get\_url:url=[https://getcomposer.org/installer](https://getcomposer.org/installer) dest=/tmp/composer\_installer mode=0777
> 
> -shell:/usr/bin/php /tmp/composer\_installer --install-dir=/usr/bin
> 
> -command:mv /usr/bin/composer.phar /usr/bin/composer
> 
> -composer:command=install working\_dir={{site\_repo\_root }}no\_dev=no
> 
> \>
> 
> \*it occurs error below \*
> 
> \>  
> TASK [site/symfony  
> :git]\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
> 
> task path:/Users/jeongwookko/git/roles/site/symfony/tasks/main.yml:1
> 
> Thefull traceback is:
> 
> WARNING:Thebelow traceback may \*not\*be related to the actual failure.
> 
> File"/tmp/ansible\_git\_payload\_0MMVFf/ansible\_git\_payload.zip/ansible/modules/source\_control/git.py",line 461,inclone
> 
> File"/usr/lib64/python2.6/os.py",line 157,inmakedirs
> 
> ```
> mkdir\(name,mode\)
> 
> ```
> 
> fatal:[xxxxxxx]:FAILED!=\>{
> 
> ```
> &quot;changed&quot;:false,
> 
> &quot;cmd&quot;:&quot;/usr/bin/git clone \-\-origin origin &#39;&#39; /var/www/xxxxxxx&quot;,
> 
> &quot;invocation&quot;:\{
> 
> &quot;module\_args&quot;:\{
> 
> &quot;accept\_hostkey&quot;:true,
> 
> &quot;archive&quot;:null,
> 
> &quot;bare&quot;:false,
> 
> �� &quot;clone&quot;:true,
> 
> &quot;depth&quot;:null,
> 
> &quot;dest&quot;:&quot;/var/www/xxxxxxx&quot;,
> 
> &quot;executable&quot;:null,
> 
> &quot;force&quot;:false,
> 
> &quot;gpg\_whitelist&quot;:\[\],
> 
> &quot;key\_file&quot;:null,
> 
> &quot;recursive&quot;:true,
> 
> &quot;reference&quot;:null,
> 
> &quot;refspec&quot;:null,
> 
> &quot;remote&quot;:&quot;origin&quot;,
> 
> &quot;repo&quot;:&quot;git@git\.aaa\.com:xxxxxxx&quot;,
> 
> &quot;separate\_git\_dir&quot;:null,
> 
> &quot;ssh\_opts&quot;:null,
> 
> &quot;track\_submodules&quot;:false,
> 
> &quot;umask&quot;:null,
> 
> &quot;update&quot;:true,
> 
> &quot;verify\_commit&quot;:false,
> 
> &quot;version&quot;:&quot;dev\_20200521&quot;
> 
> \}
> 
> \},
> 
> &quot;msg&quot;:&quot;Permission denied \(publickey\)\.\\r\\nfatal: The remote end hung up unexpectedly&quot;,
> 
> &quot;rc&quot;:128,
> 
> &quot;stderr&quot;:&quot;Permission denied \(publickey\)\.\\r\\nfatal: The remote end hung up unexpectedly\\n&quot;,
> 
> &quot;stderr\_lines&quot;:\[
> 
> &quot;Permission denied \(publickey\)\.&quot;,
> 
> &quot;fatal: The remote end hung up unexpectedly&quot;
> 
> \],
> 
> &quot;stdout&quot;:&quot;Initialized empty Git repository in /var/www/controlWeb/\.git/\\n&quot;,
> 
> &quot;stdout\_lines&quot;:\[
> 
> &quot;Initialized empty Git repository in /var/www/controlWeb/\.git/&quot;
> 
> \]
> 
> ```
> 
> }
> 
> \>
> 
> \*please help me anybody\*
> 
> \*  
> \*
> 
> \*how to solve it?\*
> 
> \*  
> \*
> 
> \*I did search it about two days but I can't find any solution of it\*

It looks to me that the ansible user on the target machine doesn't have access to the Git repository (lack of private  
key?).

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Bawoo](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@Bawoo](https://forum.ansible.com/u/Bawoo)\
**Post date:** [May 22, 2020, 9:07am UTC](https://forum.ansible.com/t/how-to-solve-it-ansible-2-9-git-permission-denied-publickey-r-nfatal-the-remote-end-hung-up-unexpectedly/33004/2 "2020-05-22T09:07:48Z")

</div>

Thank you for your answer

I missed some comments so I delete and change my text

I’m really sorry about that

2020년 5월 22일 금요일 오후 6시 2분 55초 UTC+9, Stefan Hornburg (Racke) 님의 말:
