【发布时间】:2018-12-16 19:10:55
【问题描述】:
我正在尝试使用 cPanel git 版本控制从本地->cPanel 推送代码。
我正在将我的代码推送到 github,当我合并我的分支时,它会在 CircleCI 中启动一个构建。我的构建错误,我不知道为什么。
是说远程似乎不是git仓库,但是当我直接从本地执行这个推送到cPanel时,它工作正常。
我尝试过的事情。
- 将 SSH 私钥添加到 CircleCI 并将其添加到我的构建脚本中
与
add_ssh_keys - 将公共 ssh 密钥添加到 cPanel 并对其进行授权。
.circleci/config.yml
...
deploy-staging:
machine:
enabled: true
working_directory: ~/home/
steps:
- checkout
- add_ssh_keys:
fingerprints:
- "MY:FI:NG:ER:PR:IN:T"
- run:
name: Setup and checkout Staging branch
command: |
# Add user
git config --global user.email "my@email.com"
git config --global user.name "me"
# Add cPanel remotes
git remote add my-staging ssh://my@email.com:7822/home/staging
git remote -v
git checkout -B staging
# Use specific ignore file
mv .gitignore-cpanel .gitignore
# User specific cpanel.yml file
mv .cpanel-staging.yml .cpanel.yml
mv robots-staging.txt robots.txt
- restore_cache:
keys:
- v1-artifacts-{{ .Revision }}
# fallback to using the latest cache if no exact match is found
- v1-artifacts-
- run:
name: Commit the changes to git
command: |
# Add all code, including ignored artifacts
git add .
# Include build number in commit message
git commit --message="Deploying CircleCI build $CIRCLE_BUILD_NUM to cPanel staging"
- run:
name: Deploy staging branch to cPanel Staging master branch using git push
command: git push my-staging staging:master --force
...
所以当我运行它时,我收到了这个错误
$ #!/bin/bash -eo pipefail
git push my-staging staging:master --force
fatal: 'my-staging' 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.
Exited with code 128
提前致谢。
【问题讨论】:
标签: git github yaml cpanel circleci