Skip to content

Instantly share code, notes, and snippets.

@PLaRoche
Created June 1, 2016 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PLaRoche/eef5dc31c7bca4534f8ca0cfa7bd5a2f to your computer and use it in GitHub Desktop.
Save PLaRoche/eef5dc31c7bca4534f8ca0cfa7bd5a2f to your computer and use it in GitHub Desktop.
git shell push script
#!/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