title: Unable to create gitconfig file for user
body: <p>I have installed git as root on my Linux (debian) system before I had created my user. After I created the user I try to run the command (as the new user):</p>
  
  <pre><code>git config --global user.name "myusername" 
  </code></pre>
  
  <p>But I get the error:</p>
  
  <pre><code>error: could not lock config file /home/&lt;username&gt;/.gitconfig: Permission denied
  </code></pre>
  
  <p>When I type </p>
  
  <pre><code>git config --global --edit
  </code></pre>
  
  <p>It starts my editor with the path <code>/home/&lt;username&gt;/.gitconfig</code>. I think this is really weird. I have tried to create the .gitconfig file by creating it as <strong>sudo</strong> and then move the .gitconfig file from <code>/root/.gitconfig</code> to <code>/home/&lt;username&gt;/.gitconfig</code> and lastly <strong>chown</strong> it to my user, but that does not work either. 
  Please help me..</p>
  
  <hr>
  
  <p>EDIT: 
  The problem had to do with user permissions on the home directory of the user. I just ran:</p>
  
  <pre><code>sudo chown username:username /home/username
  </code></pre>
  
  <p>And then it worked as usal.</p>