无法访问远程git存储库 [英] Cannot access remote git repository

查看:190
本文介绍了无法访问远程git存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过github网站的新建按钮创建了一个git repo。然后我用git bash来设置我的本地仓库,并试图拉我的远程仓库(它有默认的README),但得到了访问被拒绝的错误,与此问题中看到的一样:
无法推送到git存储库 - 权限被拒绝



我遵循 https://help.github.com / articles / set-up-git#platform-windows ,甚至重新打开了一个新的git bash会话,但我仍然在我的远程回购中出现访问错误。我 chmod 777 在我的本地仓库中,所以它也不是本地问题。


  1. https://github.com/new 来创建我的新远程仓库。

  2. 在我的win7计算机上打开git bash并执行以下命令:项目目录中的


    1. git init
    2. git add。递归添加所有项目文件

    3. git commit -am提交消息 git remote add origin https:// ... 产生fatal:remote origin already exists。

    4. git pull origin master 产生访问被拒绝错误。我先用ssh尝试了第4步,现在我正在尝试使用https。



    git clone 时使用ssh协议/ uri(因为这样可以避免一些配置问题)



    编辑:为了解决您现在检查您的uri的问题,因为它可能像拼写错误一样简单

    使用检查当前配置git config -l <​​/ code>

    可能更改为 git remote set-url origin git @ github .com:path / torepo.git 查看更多在这里


    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.

    解决方案

    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.

    这篇关于无法访问远程git存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆