Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ilyasemenov/gitlab-ci-git-push
Gitlab CI runner image that pushes to a remote Git repo (Dokku, Heroku, Deis, etc.)
https://github.com/ilyasemenov/gitlab-ci-git-push
Last synced: 11 days ago
JSON representation
Gitlab CI runner image that pushes to a remote Git repo (Dokku, Heroku, Deis, etc.)
- Host: GitHub
- URL: https://github.com/ilyasemenov/gitlab-ci-git-push
- Owner: IlyaSemenov
- License: mit
- Created: 2016-09-02T10:59:01.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-12-28T16:16:59.000Z (11 months ago)
- Last Synced: 2024-11-04T09:37:26.012Z (13 days ago)
- Language: Shell
- Size: 8.79 KB
- Stars: 122
- Watchers: 6
- Forks: 49
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GitLab CI runner that pushes to git
This GitLab CI runner image allows to deploy a GitLab project to a remote Git repo (useful for Dokku, Heroku, Deis, etc.)
## How to use
Create `.gitlab-ci.yml`:
```yaml
image: ilyasemenov/gitlab-ci-git-pushvariables:
# Prevent "shallow update not allowed" error.
# Set it to maximum possible count of *new* commits that you foresee being pushed to a remote.
GIT_DEPTH: 1000stages:
- deploydeploy to production:
stage: deploy
environment: production
only:
- master
script: git-push [email protected]:myapp
```Go to GitLab > Project > Settings > CI/CD > Secret Variables, and add a variable `SSH_PRIVATE_KEY`:
```
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
```Make sure your private ssh key is not encrypted, or Gitlab won't be able to authenticate to your SSH server. You'll know if it is encrypted if you open it up and the top has something like:
```
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
```If it is, you can decrypt it by running: `openssl rsa -in enc.key -out dec.key`
### Pushing to a branch other than master
By default, `git-push` will push to branch `master` of a remote repository (that's what Dokku wants). You can override this with:
```console
git-push [email protected]:repo branch
```### Pushing to Git running on a non-standard port
```console
git-push ssh://[email protected]:8022/myapp
```### Not doing force push
By default, git push will be forced. You can disable force push by setting environment variable `DISABLE_FORCE_PUSH` to any value.