You know that feeling when you’re setting up a brand new server and it’s not set up the way you’ve spent years tweaking it to be?
As opposed to the following (setting up a new linux box, not even ls works how I like it).
After taking a brief glance at alias.sh, I decided I wanted to be able to customize things just a little bit more to my liking.
I came up with the following workflow:
- Use GitHub to host a always-up-to-date published .bash_profile
- Use a TextExpander snippet to easily wget the .bash_profile from GitHub onto the new server
- [OPTIONAL] Keep my local work machine’s aliases separate from remote production machines by separating them out into a .bash_aliases file
- [OPTIONAL] One more TextExpander snippet for the .bash_aliases to make things easy
I published out my files in a new repo on GitHub, titled tersely enough: dotfiles.
I went back and forth between GitHub and BitBucket, and even tried out BitBucket since they offer free private repositories, but unfortunately BitBucket’s URLs for the RAW files include the commit hash, which would be changing with each commit, rendering my TextExpander snippet useless.
So – because I need the RAW file URL to be unchanging, I went with GitHub, even though it means publicizing all my current aliases. Oh well – enjoy 🙂
So – this gets us a public published RAW url that will not change.
I use the following command:
wget -q -O - "[email protected]" https://raw.github.com/AaronHolbrook/dotfiles/master/.bash_profile > ~/.bash_profile
and place it inside a TextExpander snippet with the shortcut of:
For my personal use case, I prefer to have my command prompt styled and things like ls and stuff always the same, regardless of if I’m on my own machine or if I’m SSHed into a server. But there are certain aliases that shortcut me to some folders, however I don’t really want those aliases to be on the server (as it’d be pointless and confusing).
Thus, I separated my aliases into a separate file, which .bash_profile only pulls in if it exists:
if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi
I use the following command to pull in the .bash_alias.
wget -q -O - "[email protected]" https://raw.github.com/AaronHolbrook/dotfiles/master/.bash_alias > ~/.bash_alias
And there you have it, a quick and dirty way to sync your always-up-to-date .bash_profile onto new machines!