Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Wednesday, October 10, 2012

Basic Git Prettification (Colors and Shortcuts) in Linux

At work, we use Git as our version control system. When I installed Git on OSX via Homebrew, it already had some useful configs setup out of the box. I love Git so much, I now host any small coding projects on Github (not much going on right now).

I installed Git on Ubuntu 12.04 using apt-get, but it failed to configure all the nice little shortcuts and color schemes I've gotten used to in OSX. Here are some useful git configs I just can't seem to do without. You can edit your .gitconfig or run these commands directly in your terminal:

Status/Diff Colors
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
Command Shortcuts
git config --global alias.br branch
git config --global alias.co checkout
git config --global alias.st status
User Info
git config --global user.name "Your Name Comes Here"
git config --global user.email you@yourdomain.example.com
Let me know what other useful settings you have in your Git configuration!

Wednesday, August 29, 2012

Simple Password Encrypted Files w/ GnuPG

If you are sending files or documents with sensitive information (eg. database credentials), you probably don't want to send it without making sure it is encrypted. In Linux and OSX, I use a tool called GnuPG to add password protection to files I want to share with other people. This is, by no means, the best way to send sensitive information to someone else, but it does provide a small layer of protection against an unintended recipient opening and reading the contents.

Install GnuPG

For Ubuntu, fire up a terminal and run:
sudo apt-get install gpg
For OSX, install Homebrew and run:
brew install gpg

Encrypting Files

To encrypt a sensitive file, navigate to the directory of the file and run:
gpg -c sensitive.txt
Output:
Enter passphrase: 
Repeat passphrase: 
If all is well, GnuPG will create an encrypted file named sensitive.txt.gpg. If someone tries to open and read the contents, they will get nothing but gibberish!

Decrypting Files

To decrypt a file, navigate to the directory of the file and run:
gpg sensitive.txt.gpg
Output:
gpg: CAST5 encrypted data
Enter passphrase: 
Now, enter the passphrase set for the file during encryption. Voila! The file is now decrypted as sensitive.txt.

Note: You may get the following: gpg: WARNING: message was not integrity protected, but it doesn't affect the result.