Cannot access remote git repository

19,091

Solution 1

To get push permissions I would use the ssh protocol/uri when doing the first git clone (since that avoids some config troubles)

Edit: To possible fix the issues you are now having check your uri since it might be as simple as a spelling mistake
Check current configuration with git config -l
Possibly change with git remote set-url origin [email protected]:path/torepo.git See more here.

Solution 2

I am using "GitHub for Windows" and have two Github accounts, sometimes switching from one to the other.

Similarly, I got this error:

remote: permission to .../....git denied to 93befbc3eeadfe14e.... fatal: unable to access 'https://github.com/....git': The requested URL returned error: 403

I solved the problem whithin "Github for Windows" program:

  1. Settings (small gear on the top-right corner) --> Options
  2. Log out
  3. Choose "Add account" which is, in fact, the same as "log in". Then used the right account (which the respective repository is belonged to).
Share:
19,091
HukeLau_DABA
Author by

HukeLau_DABA

Updated on June 04, 2022

Comments

  • HukeLau_DABA
    HukeLau_DABA almost 2 years

    I created a git repo via the github website's "new button". Then I used git bash to set up my local repo and tried to pull my remote repo (it had the default README) but got an "access denied error", the same one seen in this question: Cannot push to git repository - permission denied

    I followed https://help.github.com/articles/set-up-git#platform-windows, even reopened a new git bash session but I still get access errors on my remote repo. I chmod 777 on my local repo so it's not a local problem either.

    1. https://github.com/new to create my new remote repo.
    2. Opened git bash on my win7 computer and executed the following commands:
      1. git init in project directory
      2. git add . to recursively add all project files
      3. git commit -am "commit message"
      4. git remote add origin https://... produces "fatal: remote origin already exists".
      5. git pull origin master produces access denied error. I tried step 4 first with ssh, now I'm trying to use https.