无法将 git 存储库部署到 dokku 实例(严重:{reponame} 似乎不是 git 存储库)

can't deploy git repository to dokku instance (fatal: {reponame} does not appear to be a git repository)

我正在尝试将位于本地 git 存储库中的应用程序部署到 digitalocean 上的 dokku 实例。

区域文件

$ORIGIN mydomain.com.
$TTL 1800
...
mydomain.com. 1800 IN A 11.22.33.44
www.mydomain.com. 1800 IN CNAME mydomain.com.
*.mydomain.com. 1800 IN A 11.22.33.44
test.mydomain.com. 1800 IN A 11.22.33.44

我打算在 test.mydomain.com

上部署我的应用程序

dokku 设置

我使用 digitalocean 上的 dokku 镜像来设置服务器,目前它在 dokku v0.4.15 上运行,并尝试根据 the guide 部署我的应用程序,这很明显过时了,但是我没有找到更新的。

ssh 设置

我还设置了 SSH 密钥和配置文件,所以我可以通过 SSH 为两个用户登录我的 dokku 实例 rootdokku:

ssh {username}@test.localhome.ch // works

本地 ssh 配置文件

Host          mydomain.com test.mydomain.com
        HostName       11.22.33.44
        IdentityFile   ~/.ssh/mydomain
        PreferredAuthentications publickey

部署

当我尝试部署我的 git 存储库时:

git remote add dokku dokku@test.mydomain.com:test
git push dokku master

它会把我扔

fatal: 'test' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我错过了什么?

编辑 1

我还通过 ssh 连接到服务器并添加了 dokku 应用程序

ssh dokku@mydomain.com
dokku apps:create test

该应用程序似乎已正确添加到服务器端..

dokku@mydomain:~$ dokku apps
=====> My Apps
test

..然而,推送还是失败了

我无法解决 digitalocean 上的 oneclick dokku-installation 问题,所以我不得不手动设置实例,这并不难。

Dokku 设置

  1. 创建一个新的 Ubuntu 14.04.4 x64 液滴。
  2. 先不要设置RSA,使用密码验证登录droplet。
  3. 安装dokku

    wget https://raw.githubusercontent.com/dokku/dokku/v0.5.2/bootstrap.sh sudo DOKKU_TAG=v0.5.2 bash bootstrap.sh

设置 RSA

假设: 我们不使用默认的 RSA 密钥(通常是 .ssh/id_rsa.pub),而是使用自定义密钥:.ssh/custom.pub

  1. 使用以下一行代码添加 public 键

    猫 ~/.ssh/custom.pub | ssh root@mydomain.com "sudo sshcommand acl-add dokku custom-identifier"

更多信息请参考this page

部署存储库

部署您的存储库,可以使用 this example 进行快速测试。 此外,需要相应地设置 DNS(如果应用名称为 test,则 test.mydomain.com 应指向您的服务器 IP,如 OP 中所示)。