Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/rest-api/class-wp-rest-server.php on line 1775
{"id":280,"date":"2016-07-12T10:33:00","date_gmt":"2016-07-12T05:03:00","guid":{"rendered":"http:\/\/ash.wine\/?p=280"},"modified":"2016-11-18T15:27:34","modified_gmt":"2016-11-18T09:57:34","slug":"version-control-your-bashrc-file-or-any-other-file-with-github-gist","status":"publish","type":"post","link":"http:\/\/hacks.ash.wine\/version-control-your-bashrc-file-or-any-other-file-with-github-gist\/","title":{"rendered":"Version control your `.bashrc` file (or any other file) with Github Gist"},"content":{"rendered":"
\n

\n<\/span><\/a>Version control your .bashrc<\/code> file with Github Gist<\/h1>\n

\n<\/span><\/a>Install Gist on your machine<\/h2>\n

If you have ruby installed (how to install ruby<\/a>):<\/p>\n

\n
sudo gem install gist<\/pre>\n<\/div>\n

\u200cIf you’re using Bundler:<\/p>\n

\n
   source<\/span> :rubygems\n   gem '<\/span>gist'<\/span><\/span><\/pre>\n<\/div>\n

\u200cFor OS X, gist lives in Homebrew<\/p>\n

\n
   brew install gist<\/pre>\n<\/div>\n

\n<\/span><\/a>Log into Gist with your Github account<\/h2>\n

If you want to associate your gists with your GitHub account, you need to login
\nwith gist. It doesn’t store your username and password, it just uses them to get
\nan OAuth2 token (with the “gist” permission).<\/p>\n

gist --login\nObtaining OAuth2 access_token from github.\nGitHub username: ConradIrwin\nGitHub password:\n2-factor auth code:\nSuccess! https:\/\/github.com\/settings\/tokens\n<\/code><\/pre>\n

This token is stored in ~\/.gist<\/code> and used for all future gisting. If you need to
\nyou can revoke it from
https:\/\/github.com\/settings\/tokens<\/a>, or just delete the
\nfile. If you need to store tokens for both github.com and a Github Enterprise instance
\nyou can save your Github Enterprise token in ~\/.gist.github.example.com<\/code> where
\n“github.example.com” is the URL for your Github Enterprise instance.<\/p>\n

\u200cAfter you’ve done this, you can still upload gists anonymously with -a<\/code>.<\/p>\n

gist -a a.rb\n<\/code><\/pre>\n

Learn more about using the gist client<\/a>.<\/p>\n

\n<\/span><\/a>Create a Gist with your bashrc file<\/h2>\n

Upload your .bashrc<\/code> file to your account as a private gist using the following command<\/p>\n

\n
gist -p -o -d \"<\/span>My .bashrc\"<\/span><\/span> ~<\/span>\/.bashrc<\/pre>\n<\/div>\n

Here -p<\/code> specifies that you want this file to be private, -o<\/code> will open a new browser tab with the gist page as soon as it’s uploaded, and -d<\/code> is used to add a description for your file.<\/p>\n

\n<\/span><\/a>Create an alias for updating your file<\/h2>\n

Open your .bashrc<\/code> file with the editor of your choice, in this case I’ll be using atom.<\/p>\n

sudo atom ~\/.bashrc\n<\/code><\/pre>\n

At the end of the file add the following command<\/p>\n

\n
#Gist Bashrc alias<\/span>\nalias<\/span> gistbash=\"<\/span>gist -u GIST_ID ~\/.bashrc\"<\/span><\/span><\/pre>\n<\/div>\n

Where GIST_ID<\/code> is the id of your uploaded gist file found in the URL.
\n
\"\"<\/a><\/p>\n

Save the file and close out your editor.<\/p>\n

\n<\/span><\/a>Commit your changes<\/h2>\n

Either open a new terminal window or source your .bashrc<\/code> by using the following command<\/p>\n

\n
source<\/span> ~<\/span>\/.bashrc<\/pre>\n<\/div>\n

Now you can run your alias every time after making a change to your .bashrc<\/code> file to update your gist.<\/p>\n

\n
gistbash<\/pre>\n<\/div>\n

After you run the command you should be able to see the changes reflected on the gist!<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"

Version control your .bashrc file with Github Gist Install Gist on your machine If you have ruby installed (how to install ruby): sudo gem install gist \u200cIf you’re using Bundler: source :rubygems gem ‘gist’ \u200cFor OS X, gist lives in Homebrew brew install gist Log into Gist with your Github account If you want to […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[16,18],"_links":{"self":[{"href":"http:\/\/ash.wine\/wp-json\/wp\/v2\/posts\/280"}],"collection":[{"href":"http:\/\/ash.wine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ash.wine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ash.wine\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/ash.wine\/wp-json\/wp\/v2\/comments?post=280"}],"version-history":[{"count":1,"href":"http:\/\/ash.wine\/wp-json\/wp\/v2\/posts\/280\/revisions"}],"predecessor-version":[{"id":281,"href":"http:\/\/ash.wine\/wp-json\/wp\/v2\/posts\/280\/revisions\/281"}],"wp:attachment":[{"href":"http:\/\/ash.wine\/wp-json\/wp\/v2\/media?parent=280"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ash.wine\/wp-json\/wp\/v2\/categories?post=280"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ash.wine\/wp-json\/wp\/v2\/tags?post=280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}