首页 > 解决方案 > “在(我的应用程序)未检测到源存储库。请检查 URL 并重试。”

问题描述

我在这里有一个 Heroku 应用程序的 URL:https ://damp-sands-09329.herokuapp.com/ 。

当我转到https://github.com/new/import时,我被告知输入“您的旧存储库的克隆 URL”,我输入了站点 URL,它对我说

在https://damp-sands-09329.herokuapp.com/未检测到源存储库 。请检查 URL,然后重试。

为什么会这样?

标签: githubheroku

解决方案


Github 是正确的,您提供的不是有效的 Git 存储库 URL。

Heroku 站点或 Web URL(格式为https://xxxxxx.herokuapp.com/)是您的网站部署的地方,但不是存储源代码的地方。

你想要的是 Heroku Git URL。您可以通过 2 种方式获得此信息:

  1. 从 Heroku 仪表板

    登录您的 Heroku 仪表板 ( https://dashboard.heroku.com ),转到您的应用,然后转到Settings,然后滚动到Info部分。它被指定为Heroku Git URL,格式为https://git.heroku.com/xxxxxxx.git

    在此处输入图像描述

  2. 从 Heroku CLI

    如果您安装了 Heroku CLI,则可以使用该apps:info命令获取 Git URL。

    $ heroku apps:info app-name
    === app-name
    ...
    Git URL:        https://git.heroku.com/app-name.git
    ...
    Web URL:        https://app-name.herokuapp.com/
    

    请注意,它显示了 Git URL 和 Web URL。Github 想要 Git URL。


推荐阅读