问题
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.
https://github.com/new
to create my new remote repo.- Opened git bash on my win7 computer and executed the following commands:
git init
in project directorygit add .
to recursively add all project filesgit commit -am "commit message"
git remote add origin https://...
produces "fatal: remote origin already exists".git pull origin master
produces access denied error. I tried step 4 first with ssh, now I'm trying to use https.
回答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 git@github.com:path/torepo.git
See more here.
回答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:
- Settings (small gear on the top-right corner) --> Options
- Log out
- Choose "Add account" which is, in fact, the same as "log in". Then used the right account (which the respective repository is belonged to).
回答3:
Try
git pull origin master
and then
git push origin master
来源:https://stackoverflow.com/questions/18565876/cannot-access-remote-git-repository