title: fatal: Unable to create temporary file '/home/username/git/myrepo.git/./objects/pack/tmp_pack_XXXXXX': Permission denied
body: <p>I have been having trouble with this error message and I don't understand the proper solution to fix it or go about debugging it. I have googled the error in various forms but no real solution has presented itself. I am assuming it's an issue with permissions but I don't really know how to check or what I should check for.</p>
  
  <p>I have a server running Ubuntu 11.10 and I'm basically trying to make the initial commit to my git repo from my development machine. I'm running as root. Should I be running as the user?</p>
  
  <p><strong>Repo creation on server:</strong></p>
  
  <pre><code>$ cd /home/username/git
  $ mkdir myrepo.git
  $ cd myrepo.git/
  $ git --bare init
  </code></pre>
  
  <p><strong>Repo creation  on development machine:</strong></p>
  
  <pre><code>Goto rails project directory first
  $ git init
  $ git add .
  $ git commit -m "initial commit"
  $ bundle pack
  $ git add Gemfile.lock vendor/cache
  $ git commit -m "bundle gems"
  $ git remote add origin ssh://username@server.com/home/username/git/myrepo.git
  $ git push origin master
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <pre><code>fatal: Unable to create temporary file '/home/username/git/myrepo.git/./objects/pack/tmp_pack_XXXXXX': Permission denied
  error: pack-objects died of signal 13
  error: failed to push some refs to 'ssh://username@server.com/home/username/git/myrepo.git'
  </code></pre>
  
  <p><strong>My .git/config file:</strong></p>
  
  <pre><code>[core]
      repositoryformatversion = 0
      filemode = true
      bare = false
      logallrefupdates = true
      ignorecase = true
  [remote "origin"]
      url = ssh://username@server.com/home/username/git/myrepo.git
      fetch = +refs/heads/*:refs/remotes/origin/*
  </code></pre>
  
  <p>Similar question:
  <a href="https://stackoverflow.com/questions/2337281/how-do-i-do-an-initial-push-to-a-remote-repository-with-git?rq=1">How do I do an initial push to a remote repository with Git?</a></p>