title: Git: index file open failed: Permission denied on "git status". Hosted on Bitbucket
body: <p>I've been having this issue for the last couple of days when trying to make, either, a git status or git pull. The repository is hosted on Bitbucket.</p>
  
  <p>Tried several things to make this work (there are some posts related to this on stackoverflow, but they didn't work).</p>
  
  <p>Here is the issue:</p>
  
  <pre>
  user@Host:/repo/$ git status
  fatal: index file open failed: Permission denied
  fatal: git status --porcelain failed
  </pre>
  
  <p>If I do a "git pull":</p>
  
  <pre>
  user@Host:/repo/$ git pull
  remote: Counting objects: 77, done.
  remote: Compressing objects: 100% (30/30), done.
  remote: Total 56 (delta 37), reused 41 (delta 22)
  error: insufficient permission for adding an object to repository database .git/objects
  
  fatal: failed to write object
  fatal: unpack-objects failed
  </pre>
  
  <p>I double checked the local permissions and everything seems to be fine. I have permission to all the files.</p>
  
  <p><strong>Note:</strong></p>
  
  <p>If I use "sudo" everything seem to work as regular, however I don't have any SSH credentials for root on that deployment machine. It makes me think it is an issue with permissions (as the error explains), however: what it could be, if I'm the owner of all the files, including the files inside .git/</p>
  
  <p>Thanks in advance!</p>