Commit 6893a076 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Exit if remote exists

parent d1914a03
#!/bin/sh
set -e # exit on uncaught failure
remote_name=upstream
cd gitlab
if ! git remote | grep -q '^upstream$' ; then
git remote add upstream ${gitlab_upstream:-https://gitlab.com/gitlab-org/gitlab-ce.git}
git remote set-url --push upstream none # make 'upstream' fetch-only
git fetch upstream master
if git remote | grep -q '^upstream$' ; then
echo "Remote '${remote_name}' already exists in $(pwd). Exiting."
exit 0
fi
git branch --set-upstream-to=upstream/master master
git remote add ${remote_name} ${gitlab_upstream:-https://gitlab.com/gitlab-org/gitlab-ce.git}
git remote set-url --push ${remote_name} none # make 'upstream' fetch-only
git fetch ${remote_name} master
git branch --set-upstream-to=${remote_name}/master master
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment