title: .git/config permission denied when trying to add remote on ubuntu
body: <p>I am trying to add an extra remote to an existing git project so I can push code to a secondary bitbucket repository using the <strong>git remote add user2 git@bitbucket.org:...</strong> ,  but I am getting the following error:</p>
  
  <blockquote>
    <p>error: could not lock config file .git/config: Permission denied</p>
  </blockquote>
  
  <p>It is an old project so I am not sure how it was originally setup, but it does seem like it may have been installed as root.</p>
  
  <p>I tried checking the file permissions for .git and .git/config and I can see it belongs to www-data.  My current user is part of the www-data group, but I still get the same error. </p>
  
  <p>I also checked for .git/config.lock file just in case it was blocking but there isn't one.</p>
  
  <p>I am not a fan of using sudo with .git, so I am wondering if someone can give me some best practice advice on how deal with this</p>