[英]Cannot access remote git repository
I created a git repo via the github website's "new button". 我通过github网站的“新按钮”创建了一个git repo。 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 然后,我使用git bash设置了本地存储库,并尝试拉出远程存储库(它具有默认的README),但出现了“访问被拒绝错误”,在此问题中也看到了同样的错误: 无法推送到git存储库-权限被拒绝
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. 我遵循了https://help.github.com/articles/set-up-git#platform-windows ,甚至重新打开了一个新的git bash会话,但是我在远程仓库上仍然遇到访问错误。 I chmod 777
on my local repo so it's not a local problem either. 我在本地仓库中使用chmod 777
,因此也不是本地问题。
https://github.com/new
to create my new remote repo. https://github.com/new
创建我的新远程仓库。 git init
in project directory 项目目录中的git init
git add .
to recursively add all project files 递归添加所有项目文件 git commit -am "commit message"
git remote add origin https://...
produces "fatal: remote origin already exists". git remote add origin https://...
产生“致命错误:远程来源已存在”。 git pull origin master
produces access denied error. git pull origin master
产生访问被拒绝错误。 I tried step 4 first with ssh, now I'm trying to use https. 我首先使用ssh尝试了步骤4,现在我正在尝试使用https。 I am using " GitHub for Windows " and have two Github accounts , sometimes switching from one to the other. 我正在使用“ 适用于Windows的GitHub ”并有两个Github帐户 ,有时会从一个切换到另一个。
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 远程:对... / .... git的权限被拒绝给93befbc3eeadfe14e .......致命:无法访问' https://github.com/....git ':请求的URL返回错误:403
I solved the problem whithin " Github for Windows " program: 我解决了“ Github for Windows ”程序中的问题:
To get push permissions I would use the ssh protocol/uri when doing the first git clone
(since that avoids some config troubles) 为了获得推送权限,我将在执行第一个git clone
时使用ssh协议/ uri(因为这避免了一些配置麻烦)
Edit: To possible fix the issues you are now having check your uri since it might be as simple as a spelling mistake 编辑:为了可能解决您现在正在检查uri的问题,因为它可能像拼写错误一样简单
Check current configuration with git config -l
使用git config -l
检查当前配置
Possibly change with git remote set-url origin git@github.com:path/torepo.git
See more here . 可能使用git remote set-url origin git@github.com:path/torepo.git
更改git remote set-url origin git@github.com:path/torepo.git
在此处查看更多信息 。
Try 尝试
git pull origin master
and then 接着
git push origin master
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.