title: Git: ERROR: Permission to repo.git denied to user
body: <p>I'm unable to push (but pull works fine) to my company's git repository over both HTTPS and SSH, and would really appreciate any help on this. It's a similar issue to the one seen here: (<a href="https://stackoverflow.com/questions/5335197/gits-famous-error-permission-to-git-denied-to-user">Git&#39;s famous &quot;ERROR: Permission to .git denied to user&quot;</a>) except that I'm pushing to a company repo rather than a personal repo -- wondering if this might have something to do with a company firewall.</p>
  
  <p>Here's what I've done (after already cloning the repo):</p>
  
  <h2>Over SSH:</h2>
  
  <pre><code>git remote set-url origin [SSH url of my company repo]
  </code></pre>
  
  <p>Set up my ssh key and added it to my user account; ssh to git@github.com gives me permission denied (publickey), but ssh to git@git.soma.company.com authenticates succesfully.</p>
  
  <pre><code>git pull
  git push origin master
  </code></pre>
  
  <p>Which gives me:</p>
  
  <blockquote>
    <p>ERROR: Permission to Organization/repo.git denied to user.
    fatal: The remote end hung up unexpectedly</p>
  </blockquote>
  
  <h2>Over HTTPS:</h2>
  
  <pre><code>git remote set-url origin [HTTPS url of my company repo]
  git pull
  git push origin master
  </code></pre>
  
  <p>Which prompts me for username and password and then gives me:</p>
  
  <blockquote>
    <p>error: Cannot access URL [HTTPS url of my company repo], return code 22
    fatal: git-http-push failed</p>
  </blockquote>
  
  <p>Here are the contents of my .git/config:</p>
  
  <pre><code>[core]
  repositoryformatversion = 0
  filemode = true
  bare = false
  logallrefupdates = true
  [remote "origin"]
  fetch = +refs/heads/*:refs/remotes/origin/*
  url = [HTTPS url of my company repo]
  [branch "master"]
  remote = origin
  merge = refs/heads/master
  </code></pre>
  
  <p>I've confirmed that I've been added as a collaborator to the organization. Removing myself and getting re-added hasn't fixed the problem, and neither has deleting my ssh keys and generating new ones and adding them to my account. I also tried deleting my entire user account and setting up from scratch, which solved this problem once before, but it doesn't seem to work now and produces the same errors.</p>
  
  <p>One thing is, this problem occurred initially when I set up my git access to the repo, and I solved it by deleting my user account and setting up again. For the next 2 months I was able to successfully push to the repo over HTTPS without a problem. These errors showed up again after a team member set up their access and pushed some code; could this be a source of the problem?</p>
  
  <p>If anyone can help me out, I would be eternally grateful.</p>