03 Jul 2020
|
git
Often times people have two GitHub accounts - one for work and personal. Good post on how to manage these accounts here.
As mentioned in one of the comments in the same post, it is also important to configure the ssh-agent to make this work.
And in case one gets mixed up with the two ids (before making the above change), this StackOverflow answer provides a way to clean it up.
If you correctly implement the above steps, your ssh config will look like the following
#Default GitHub
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
Host github-<COMPANY>
HostName github.<COMPANY>.com
User git
IdentityFile ~/.ssh/id_rsa_<COMPANY>
IdentitiesOnly yes
In addition to the above steps, if there are any repositories in the your company’s Git that you have already checked out and after making the above changes, you would need to update them as well.
- The typical
remote.origin.url
for a repo looks like git@github.<COMPANY>.com:<ORG_OR_USER/PROJECT_NAME>.git
. Change this to the correct URL
git remote set-url origin git@github-<COMPANY>:<ORG_OR_USER/PROJECT_NAME>.git
this will result the changed config remote.origin.url=git@github-<COMPANY>:ORG_OR_USER/<PROJECT_NAME>.git
- Change the email config to the correct email address
git config --local user.email <your_email>@<COMPANY>.com
if it is messed up due to the multiple accounts.
03 Dec 2018
|
sublimetext
markdown
The Sublime Text’s support for Markdown is amazing. There are many supported plugins. As suggested in this article, I found Markdown Editing and Markdown Preview to be the most interesting.
But there can be a potential problem during the installation of Mardown Editing - after the Plugin is installed, it once you open the “Mardown Settings - User”, it displays an error which looks like this
Error loading syntax file "Packages/Markdown/Markdown.sublime-syntax": Unable to read Packages/Markdown/Markdown.sublime-syntax
This is usually due to a markdown file that is currently open during the time of installation of the Markdown Editing package. Just close the file and restart the Sublime Text and the error goes away.
03 Dec 2018
|
blog
jekyll
sublimetext
icloud
Many Plugins such as Jekyll don’t really understand the configuration paths if they are located on the iCloud Drive (com~apple~CloudDocs). I have found it easier to just create a symlink in my local drive to the iCloud Drive like the following
/Users/$USER/Library/Mobile\ Documents/com~apple~CloudDocs/SublimeText/projects/project_name alias_project_name
So that, my Jekyll configuration looks like this
{
...
"settings":
{
"Jekyll":
{
"jekyll_posts_path": "<local_path>/alias_blog/_posts",
"jekyll_drafts_path": "<local_path>/alias_blog/_posts/_drafts",
"jekyll_templates_path": "<local_path>/alias_blog/_posts/_layouts",
...,
}
}
}
Also, following this, I have moved all the sublime configuration to the iCloud so that I can sync them between the macs.
mkdir -p /Users/$USER/Library/Mobile\ Documents/com~apple~CloudDocs/SublimeText/sync/
cd ~/Library/Application\ Support/Sublime\ Text\ 3/
mv Installd\ Packages /Users/$USER/Library/Mobile\ Documents/com~apple~CloudDocs/SublimeText/sync/
ln -s /Users/$USER/Library/Mobile\ Documents/com~apple~CloudDocs/SublimeText/sync/Installed\ Packages
mv Packages /Users/$USER/Library/Mobile\ Documents/com~apple~CloudDocs/SublimeText/sync/
ln -s /Users/$USER/Library/Mobile\ Documents/com~apple~CloudDocs/SublimeText/sync/Packages
03 Dec 2018
|
blog
jekyll
sublimetext
It is possible to create a Jekyll based blog and maintain it with just terminal based tools (vi
etc.). But having a decent text editor such as Sublime Text makes this much less of a chore. Assuming that you have both Jekyll and Sublime Text installed already, here is how you can configure Sublime Text.
Jekyll Plugin
Enter sublime-jekyll, a Jekyll Plugin for Sublime Text. The first step is into install the Sublime Text package manager, Package Control
.
First invoke Command Palette
by pressing ↑+⌘+P
Type Package Control
In the drop down, select Install Package
In the next search window type “jekyll” and press ⏎
Once the Plugin is successfully installed, it is time to configure it. Go to Project
➡️ Edit Project
. It will open a blank file. Update it look something like this.
{
"folders":
[
{
"follow_symlinks": true,
"path": "<path_to_the_repo_of_blog>"
}
],
"settings":
{
"Jekyll":
{
"jekyll_posts_path": "<path_to_the_repo_of_blog>/_posts",
"jekyll_drafts_path": "<path_to_the_repo_of_blog>/_drafts",
"jekyll_templates_path": "<path_to_the_repo_of_blog>/_layouts",
"jekyll_auto_find_paths": true,
}
}
}
Save the file with a name like blog.sublime-project
. Once the file is saved, you should be able to see all your repository folders (created earlier in command line by Jekyll) appear on the left panel of the editor if you have the show side bar enabled from the View
menu. Sublime calls this a Project
. The Plugin allows one to create drafts and promote / publish them (and a lot more capabilities) from Sublime Text. The Jekyll tutorial that I used to create the blog didn’t have placeholders for drafts. I manually created a folder called _drafts
in my repository.
Build System
The next step is to create a build system and attach it to the Project
. To do this, we can add the following snippet to the configuration above
"build_systems": [{
"name": "Jekyll",
"cmd": "<some_path>/jekyll-build-script.sh",
"shell": true,
"encoding": "UTF-8",
"working_dir": "<path_to_the_repo_of_blog>"
}]
The jekyll-build-script.sh
contains the commands that you would normally use to build
and serve
in command line.
echo "Start building..."
rbenv local 2.5.3
echo $1
cd "$1"
/Users/$USER/.rbenv/shims/jekyll serve -t
Once this is setup, launching the local server is as easy as hitting ⌘ + b
in Sublime Text.
20 Aug 2018
|
blog
jekyll
The simplest way to install Jekyll is using Homebrew if the operating system is MacOS. Assuming that the Homebrew is already installed, we need make sure that it is up-to-date.
Also, Jekyll is built on top of Ruby. We might not want to mess around with the Ruby installation that comes with the MacOS. So it is preferably to install rbenv
first.
brew update
brew install rbenv
ex -sc '1i|export PATH=$HOME/.rbenv/bin:$HOME/.rbenv/shims:/usr/local/bin:$PATH' -cx ~/.bash_profile
rbenv local 2.5.3
gem install jekyll
gem install bundler