使用不同的端口 22 将代码从 GitLab 推送到 Dokku
Push code from GitLab to Dokku with different port 22
我使用 Dokku 来托管我的应用程序。
我使用 GitLab 来托管我的代码。
我使用 GitLab-CI 进行持续集成。
before_script:
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" | tr -d "\r" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host $APP_NAME\n\tStrictHostKeyChecking no\n\tHostName $HOSTNAME\n\tUser $USERNAME\n\tPort $PORT\n\tIdentityFile ~/.ssh/id_rsa\n\n" > ~/.ssh/config
- ssh-keyscan -H "$HOSTNAME" >> ~/.ssh/known_hosts
我想将我的代码从 GitLab 推送到 Dokku。
$USERNAME is dokku
$APP_NAME is hostname in .ssh/config
$APP_NAME_STAGING is name of Dokku application
我的 SSH Dokku 服务器端口是 1990 而不是 22。
问题是我必须在配置中使用主机名来推送远程仓库。
$ git-push ssh://$USERNAME@$APP_NAME:$APP_NAME_STAGING master
getaddrinfo example: Name does not resolve
getaddrinfo example: Name does not resolve
getaddrinfo example: Name does not resolve
fatal: No path specified. See 'man git-pull' for valid url syntax
ERROR: Job failed: exit code 1
首先你的url语法错误...
正确的语法是 protocol://user@hostname:port/path
,所以在你的情况下 ssh://$USERNAME@$APP_NAME/$APP_NAME_STAGING
根据您当前的语法,它会将 $APP_NAME:APP_NAME_STAGING
解释为主机名,这就是它 return Name does not resolve
的原因
对于自定义端口(如上所述),示例:
# User: 'dokku'
# Server adress: 'myserver.com'
# Port: '32'
# Appname: 'myawesomeapp'
ssh://dokku@myserver.com:32/myawesomeapp
你的情况:
ssh://$USERNAME@$APP_NAME:1990/$APP_NAME_STAGING
你应该看看这个:https://github.com/dokku/dokku/blob/master/docs/community/tutorials/deploying-with-gitlab-ci.md
我使用 Dokku 来托管我的应用程序。
我使用 GitLab 来托管我的代码。
我使用 GitLab-CI 进行持续集成。
before_script:
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" | tr -d "\r" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host $APP_NAME\n\tStrictHostKeyChecking no\n\tHostName $HOSTNAME\n\tUser $USERNAME\n\tPort $PORT\n\tIdentityFile ~/.ssh/id_rsa\n\n" > ~/.ssh/config
- ssh-keyscan -H "$HOSTNAME" >> ~/.ssh/known_hosts
我想将我的代码从 GitLab 推送到 Dokku。
$USERNAME is dokku
$APP_NAME is hostname in .ssh/config
$APP_NAME_STAGING is name of Dokku application
我的 SSH Dokku 服务器端口是 1990 而不是 22。
问题是我必须在配置中使用主机名来推送远程仓库。
$ git-push ssh://$USERNAME@$APP_NAME:$APP_NAME_STAGING master
getaddrinfo example: Name does not resolve
getaddrinfo example: Name does not resolve
getaddrinfo example: Name does not resolve
fatal: No path specified. See 'man git-pull' for valid url syntax
ERROR: Job failed: exit code 1
首先你的url语法错误...
正确的语法是 protocol://user@hostname:port/path
,所以在你的情况下 ssh://$USERNAME@$APP_NAME/$APP_NAME_STAGING
根据您当前的语法,它会将 $APP_NAME:APP_NAME_STAGING
解释为主机名,这就是它 return Name does not resolve
对于自定义端口(如上所述),示例:
# User: 'dokku'
# Server adress: 'myserver.com'
# Port: '32'
# Appname: 'myawesomeapp'
ssh://dokku@myserver.com:32/myawesomeapp
你的情况:
ssh://$USERNAME@$APP_NAME:1990/$APP_NAME_STAGING
你应该看看这个:https://github.com/dokku/dokku/blob/master/docs/community/tutorials/deploying-with-gitlab-ci.md