Created
June 1, 2016 23:26
-
-
Save PLaRoche/eef5dc31c7bca4534f8ca0cfa7bd5a2f to your computer and use it in GitHub Desktop.
git shell push script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Deploy to via pushing to a remote git repository. | |
# | |
# Add the following environment variables to your project configuration and make | |
# sure the public SSH key from your projects General settings page is allowed to | |
# push to the remote repository as well. | |
# * REMOTE_REPOSITORY, e.g. "git@github.com:codeship/documentation.git" | |
# * REMOTE_BRANCH, e.g. "production" | |
# | |
# | |
# Include in your builds via | |
# \curl -sSL https://raw.githubusercontent.com/codeship/scripts/master/deployments/git_push.sh | bash -s | |
REMOTE_REPOSITORY=${REMOTE_REPOSITORY:?'You need to configure the REMOTE_REPOSITORY environment variable!'} | |
REMOTE_BRANCH=${REMOTE_BRANCH:?'You need to configure the REMOTE_BRANCH environment variable!'} | |
set -e | |
git fetch --unshallow || true | |
git push ${REMOTE_REPOSITORY} ${REMOTE_BRANCH} | |
#alternative git push line, seems to have issues | |
#git push ${REMOTE_REPOSITORY} ${CI_COMMIT_ID}:${REMOTE_BRANCH} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment