AWS-Ubuntu-Git Setup error fatal: $HOME not set
<p>I have some <strong>cloudinit</strong> scripts to execute when my <strong>AWS EC2 Ubuntu</strong> instance starts up. </p>

<p>I want to setup <strong>GIT</strong> config variables, with the code below.</p>

<pre><code>#cloud-config
runcmd:
- [ sh, -c, "git config --global user.name 'myname'"]
</code></pre>

<p>When logged into the terminal. I can execute <strong><em>git config --global user.name 'myname'</em></strong> with no problem.</p>

<p>However when I attempt to start my instance with the <strong>cloudinit</strong> code. I get an error message </p>

<blockquote>
  <p>fatal: $HOME not set</p>
</blockquote>

<p>My understanding is this is because the <strong>HOME</strong> is not set when the instance starts up.</p>

<p>Looking for a solution, to get the git variable to be set on startup or an alternate solution.</p>