👋 We've unified all of GitHub's product documentation in one place! Check out the content for REST API, GraphQL API, and Developers. Learn more on the GitHub blog.

文章版本: Enterprise Server 2.19

HTTPS 克隆错误

对 Git 使用 HTTPS 时有几种常见错误。 这些错误通常表示您有旧版 Git,或无法访问仓库。


Were you able to find what you were looking for?

下面是您可能收到的 HTTPS 错误示例:

> error: The requested URL returned error: 401 while accessing
> https://主机名/user/repo.git/info/refs?service=git-receive-pack
> fatal: HTTP request failed
> Error: The requested URL returned error: 403 while accessing
> https://主机名/user/repo.git/info/refs
> fatal: HTTP request failed
> Error: https://主机名/user/repo.git/info/refs not found: did you run git
> update-server-info on the server?

检查 Git 版本

与 GitHub Enterprise 交互没有最低 Git 版本要求,但我们发现 1.7.10 版是一个方便、稳定的版本,适用于许多平台。 您可随时在 Git 网站上下载最新版本


您要提取的仓库必须存在于 您的 GitHub Enterprise Server 实例 上,且 URL 区分大小写。

您可以打开命令行并输入 git remote -v 来查找本地仓库的 URL:

$ git remote -v
# View existing remotes
> origin  https://github.com/github/reactivecocoa.git (fetch)
> origin  https://github.com/github/reactivecocoa.git (push)

$ git remote set-url origin https://github.com/github/ReactiveCocoa.git
# Change the 'origin' remote's URL

$ git remote -v
# Verify new remote URL
> origin  https://github.com/github/ReactiveCocoa.git (fetch)
> origin  https://github.com/github/ReactiveCocoa.git (push)

也可通过 GitHub Desktop 应用程序更改 URL。


To access GitHub, you must authenticate with a personal access token instead of your password. For more information, see "Creating a personal access token."



Tip: If you don't want to enter your credentials every time you interact with the remote repository, you can turn on credential caching.

改用 SSH

如果您以前设置了 SSH 密钥,便可使用 SSH 克隆 URL,而不使用 HTTPS。 更多信息请参阅“我应使用哪个远程 URL?

Were you able to find what you were looking for?