# Git "nonexistent/.ssh" issue

**URL:** <https://discourse.chef.io/t/git-nonexistent-ssh-issue/4169>\
**Category:** Chef Infra (archive)\
**Created:** [June 8, 2013, 12:29am UTC](https://discourse.chef.io/t/git-nonexistent-ssh-issue/4169 "2013-06-08T00:29:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Liam\_Kirsher](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/liam_kirsher/32/279_2.png) [@Liam\_Kirsher](https://discourse.chef.io/u/Liam_Kirsher)\
**Post date:** [June 8, 2013, 12:29am UTC](https://discourse.chef.io/t/git-nonexistent-ssh-issue/4169/1 "2013-06-08T00:29:21Z")

</div>

Okay, so I've abandoned using Mercurial and converted repo to Git.  
I'm using git from within the Application cookbook, which uses scm.

Looks like it fails because it can't create the file and dir for the  
user it is running as (presumably root).  
Any idea how to fix that?

I'm getting my deploy\_key from a data bag. Just to confirm -- the  
deploy\_key is the ascii representation of the key, not a file path, right?

> Mixlib::ShellOut::ShellCommandFailed
> 
> * * *
> 
> Expected process to exit with [0], but received '128'  
> ---- Begin output of git ls-remote  
> [git@bitbucket.org](mailto:git@bitbucket.org):lkirsher/server-git.git master ----  
> STDOUT:  
> STDERR: Could not create directory '/nonexistent/.ssh'.  
> Failed to add the host to the list of known hosts  
> (/nonexistent/.ssh/known\_hosts).  
> Permission denied (publickey).  
> fatal: The remote end hung up unexpectedly  
> ---- End output of git ls-remote  
> [git@bitbucket.org](mailto:git@bitbucket.org):lkirsher/server-git.git master ----  
> Ran git ls-remote [git@bitbucket.org](mailto:git@bitbucket.org):lkirsher/server-git.git master  
> returned 128

--  
Liam Kirsher  
PGP: [http://liam.numenet.com/pgp/](http://liam.numenet.com/pgp/)

---

<div class="post-metadata">

**Author:** ![Morgan\_Blackthorne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/morgan_blackthorne/32/100_2.png) [@Morgan\_Blackthorne](https://discourse.chef.io/u/Morgan_Blackthorne)\
**Post date:** [June 8, 2013, 12:40am UTC](https://discourse.chef.io/t/git-nonexistent-ssh-issue/4169/2 "2013-06-08T00:40:09Z")

</div>

The problem isn't on the server end, at least not at first, the problem is  
your client can't cache the ssh host key of the server. You need to resolve  
that for it to communicate with the server, or your client will consider it  
untrusted.

On Friday, June 7, 2013, Liam Kirsher wrote:

> Okay, so I've abandoned using Mercurial and converted repo to Git.  
> I'm using git from within the Application cookbook, which uses scm.
> 
> Looks like it fails because it can't create the file and dir for the user  
> it is running as (presumably root).  
> Any idea how to fix that?
> 
> I'm getting my deploy\_key from a data bag. Just to confirm -- the  
> deploy\_key is the ascii representation of the key, not a file path, right?
> 
> Mixlib::ShellOut::ShellCommandFailed
> 
> * * *
> 
> Expected process to exit with [0], but received '128'  
> ---- Begin output of git ls-remote  
> [git@bitbucket.org](mailto:git@bitbucket.org):lkirsher/server-git.git \<javascript:\_e({}, 'cvml',  
> 'git@bitbucket.org:lkirsher/server-git.git');\> master ----  
> STDOUT:  
> STDERR: Could not create directory '/nonexistent/.ssh'.  
> Failed to add the host to the list of known hosts  
> (/nonexistent/.ssh/known\_hosts).  
> Permission denied (publickey).  
> fatal: The remote end hung up unexpectedly  
> ---- End output of git ls-remote [git@bitbucket.org](mailto:git@bitbucket.org):lkirsher/server-git.git\<javascript:\_e({}, 'cvml', 'git@bitbucket.org:lkirsher/server-git.git');\>master ----  
> Ran git ls-remote [git@bitbucket.org](mailto:git@bitbucket.org):lkirsher/server-git.git\<javascript:\_e({}, 'cvml', 'git@bitbucket.org:lkirsher/server-git.git');\>master returned 128
> 
> --  
> Liam Kirsher  
> PGP: [http://liam.numenet.com/pgp/](http://liam.numenet.com/pgp/)

## --

~_~ StormeRider ~_~

"Every world needs its heroes [...] They inspire us to be better than we  
are. And they protect from the darkness that's just around the corner."

(from Smallville Season 6x1: "Zod")

On why I hate the phrase "that's so lame"... [http://bit.ly/Ps3uSS](http://bit.ly/Ps3uSS)

---

<div class="post-metadata">

**Author:** ![Morgan\_Blackthorne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/morgan_blackthorne/32/100_2.png) [@Morgan\_Blackthorne](https://discourse.chef.io/u/Morgan_Blackthorne)\
**Post date:** [June 8, 2013, 12:50am UTC](https://discourse.chef.io/t/git-nonexistent-ssh-issue/4169/3 "2013-06-08T00:50:25Z")

</div>

Also, check the home directory of the user running this. That's the only  
place I can think of that /nonexistent to come from.

On Friday, June 7, 2013, Morgan Blackthorne wrote:

> The problem isn't on the server end, at least not at first, the problem is  
> your client can't cache the ssh host key of the server. You need to resolve  
> that for it to communicate with the server, or your client will consider it  
> untrusted.
> 
> On Friday, June 7, 2013, Liam Kirsher wrote:
> 
> > Okay, so I've abandoned using Mercurial and converted repo to Git.  
> > I'm using git from within the Application cookbook, which uses scm.
> > 
> > Looks like it fails because it can't create the file and dir for the user  
> > it is running as (presumably root).  
> > Any idea how to fix that?
> > 
> > I'm getting my deploy\_key from a data bag. Just to confirm -- the  
> > deploy\_key is the ascii representation of the key, not a file path, right?
> > 
> > Mixlib::ShellOut::ShellCommandFailed
> > 
> > * * *
> > 
> > Expected process to exit with [0], but received '128'  
> > ---- Begin output of git ls-remote  
> > [git@bitbucket.org](mailto:git@bitbucket.org):lkirsher/server-git.git master ----  
> > STDOUT:  
> > STDERR: Could not create directory '/nonexistent/.ssh'.  
> > Failed to add the host to the list of known hosts  
> > (/nonexistent/.ssh/known\_hosts).  
> > Permission denied (publickey).  
> > fatal: The remote end hung up unexpectedly  
> > ---- End output of git ls-remote  
> > [git@bitbucket.org](mailto:git@bitbucket.org):lkirsher/server-git.git master ----  
> > Ran git ls-remote [git@bitbucket.org](mailto:git@bitbucket.org):lkirsher/server-git.git master  
> > returned 128
> > 
> > --  
> > Liam Kirsher  
> > PGP: [http://liam.numenet.com/pgp/](http://liam.numenet.com/pgp/)
> 
> ## --
> 
> ~_~ StormeRider ~_~
> 
> "Every world needs its heroes [...] They inspire us to be better than we  
> are. And they protect from the darkness that's just around the corner."
> 
> (from Smallville Season 6x1: "Zod")
> 
> On why I hate the phrase "that's so lame"... [http://bit.ly/Ps3uSS](http://bit.ly/Ps3uSS)

## --

~_~ StormeRider ~_~

"Every world needs its heroes [...] They inspire us to be better than we  
are. And they protect from the darkness that's just around the corner."

(from Smallville Season 6x1: "Zod")

On why I hate the phrase "that's so lame"... [http://bit.ly/Ps3uSS](http://bit.ly/Ps3uSS)

---

<div class="post-metadata">

**Author:** ![Liam\_Kirsher](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/liam_kirsher/32/279_2.png) [@Liam\_Kirsher](https://discourse.chef.io/u/Liam_Kirsher)\
**Post date:** [June 8, 2013, 12:52am UTC](https://discourse.chef.io/t/git-nonexistent-ssh-issue/4169/4 "2013-06-08T00:52:35Z")

</div>

Yeah, I figured someone else had encountered this before and would have  
solution.  
scm allows setting the ssh deploy shell, which I could make contain

|-o UserKnownHostsFile=/dev/null|

Or, alternatively, set up different user/group. (currently nobody/nogroup)

On 06/07/2013 05:40 PM, Morgan Blackthorne wrote:

> The problem isn't on the server end, at least not at first, the  
> problem is your client can't cache the ssh host key of the server. You  
> need to resolve that for it to communicate with the server, or your  
> client will consider it untrusted.
> 
> On Friday, June 7, 2013, Liam Kirsher wrote:
> 
> ```
> Okay, so I've abandoned using Mercurial and converted repo to Git.
> I'm using git from within the Application cookbook, which uses scm.
> 
> Looks like it fails because it can't create the file and dir for
> the user it is running as (presumably root).
> Any idea how to fix that?
> 
> I'm getting my deploy_key from a data bag. Just to confirm -- the
> deploy_key is the ascii representation of the key, not a file
> path, right?
> 
> ```
> 
> > ```
> > Mixlib::ShellOut::ShellCommandFailed
> > 
> > ------------------------------------
> > 
> > Expected process to exit with [0], but received '128'
> > ---- Begin output of git ls-remote
> > git@bitbucket.org:lkirsher/server-git.git <javascript:_e({},
> > 'cvml', 'git@bitbucket.org:lkirsher/server-git.git');> master ----
> > STDOUT:
> > STDERR: Could not create directory '/nonexistent/.ssh'.
> > Failed to add the host to the list of known hosts
> > (/nonexistent/.ssh/known_hosts).
> > Permission denied (publickey).
> > fatal: The remote end hung up unexpectedly
> > ---- End output of git ls-remote
> > git@bitbucket.org:lkirsher/server-git.git <javascript:_e({},
> > 'cvml', 'git@bitbucket.org:lkirsher/server-git.git');> master ----
> > Ran git ls-remote git@bitbucket.org:lkirsher/server-git.git
> > <javascript:_e({}, 'cvml',
> > 'git@bitbucket.org:lkirsher/server-git.git');> master returned 128
> > 
> > ```
> 
> ```
> -- 
> Liam Kirsher
> PGP: http://liam.numenet.com/pgp/
> 
> ```
> 
> ## --
> 
> ~_~ StormeRider ~_~
> 
> "Every world needs its heroes [...] They inspire us to be better than  
> we are. And they protect from the darkness that's just around the corner."
> 
> (from Smallville Season 6x1: "Zod")
> 
> On why I hate the phrase "that's so lame"... [http://bit.ly/Ps3uSS](http://bit.ly/Ps3uSS)

--  
Liam Kirsher  
PGP: [http://liam.numenet.com/pgp/](http://liam.numenet.com/pgp/)
