Skip to content

Instantly share code, notes, and snippets.

@justfalter
Created August 24, 2013 14:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justfalter/6328587 to your computer and use it in GitHub Desktop.
Save justfalter/6328587 to your computer and use it in GitHub Desktop.
Preventing myself from performing git commits from the wrong host

When I have to develop on Linux platforms, I'll typically mount the filesystem remotely, and and write all my code from my Mac. I'll then ssh into the remote host to build and execute my code.

I'll use the same channel for managing my source code, running git locally rather than on the remote host. This is because 9 times out of 10, I'll have accidentally made several commits as 'root' on the remote host because I've forgotten to configure git in the first place.

A simple way I avoid this is by adding the following to my .bashrc or /etc/bash.bashrc on the remote host:

alias git="echo \"DONT'T USE GIT HERE, DUMBASS\""

I giggle every time this message pops up, and then immediately switch to the proper terminal. If I really have to run git on the remote host, I can just call /usr/bin/git, directly.

This might seem completely trivial or obvious to most people, but it's saved my bacon several times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment