Github:使用 ssh 克隆有效,但 https 不起作用


admins-MacBook-Pro:Dev sam$ git clone https://github.com/pr.git
Cloning into 'pr'...
fatal: remote error:
Repository not found.
admins-MacBook-Pro:Dev sam$ git clone git@github.com:pr.git
Cloning into 'pr'...
...
Checking connectivity... done.

如您所见,git clonessh作品,但不https. 如何使其与https一起使用?

  1. check url

    如果网址正确,我们可以在输入网址时看到页面。

  2. 检查远程存储库是专用还是公共

    如果存储库是专用存储库,则无法访问凭据或凭据错误。

    而不是

    git clone https://github.com/NAME/repo.git
    

    网址应为

    git clone https://username:password@github.com/NAME/repo.git
    

最新更新