Skip to content

Instantly share code, notes, and snippets.

@omega
Created January 7, 2014 03:29
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 omega/8294263 to your computer and use it in GitHub Desktop.
Save omega/8294263 to your computer and use it in GitHub Desktop.
Make it harder to push to a remote
# Add a new remote, called safe
$ git remote add -f safe `git remote -v | grep origin | grep push | awk '{ print $2 }'`
# Set the push url of this remote to nowhere
$ git remote set-url --push safe nowhere
# Set the upstream branch for our branch to safe origin
$ git branch --set-upstream-to=safe/master
# lets try a push
$ git push
fatal: 'nowhere' 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment