[Jekyll] Building My Own Blog with GitHub Pages - 3. Installing Git
[Jekyll] Building My Own Blog with GitHub Pages - 3. Installing Git
※ This post has been restored from an old post written during the Jekyll era.
GitHub manages each project as a single Repository. A created Repository can be managed using Git. The GitHub page itself allows you to create, modify, and delete files within a Repository, but that's very cumbersome, so it's generally recommended to use Git instead.
In the previous chapter, we created a GitHub account. Let's go to the GitHub homepage and log in.
This shows the full list of Repositories managed under this account. If you haven't done anything yet, it will look as simple as the picture above. Click the Create Repository button to create a new Repository.
- Owner: the owner. You're set as the default.
- Repository name: the Repository's name. For blog hosting, set it to {username}.github.io.
- Public / Private: whether the Repository is public. A Repository used for hosting must be Public.
There's one important thing to note here: the Repository's name must be set to {username}.github.io. For example, if your username is test, the Repository's name should be test.github.io. Be careful — it's your username, not your account ID. You can check your username on your profile page.
GitHub Pages hosts a Repository named {username}.github.io at the Root (/) path. In other words, it becomes https://{username}.github.io. If it's a regular Repository not in this format, it's hosted under a subpath, like https://{username}.github.io/{Repository Name}.
Since Repository names within a single account cannot be duplicated, only one Repository per account can be hosted at the Root path. You can somewhat work around this by creating multiple accounts.
The remaining options don't affect hosting, so you can ignore them and move on. After confirming your entries, click Create Repository to create it. You'll see that the newly created Repository has been added to your Repository list.
We'll be uploading the Jekyll blog source to this Repository going forward.
Accessing the newly created repository shows a screen like the one above. The content shown here is a guide explaining the procedure for creating a repository on your PC using Git commands and linking it with the remote repository on GitHub to manage your source code.
Now let's install Git to manage the Repository we created. Git is a powerful version control tool that lets you efficiently manage source code, developed by Linus Benedict Torvalds, the father of Linux. In a broad sense, it's similar to the copying and backing up we commonly do, but Git is far more powerful than that.
- Source code backup is possible with just command-line input.
- As long as you have an environment that can communicate with the Git repository, you can pull, modify, and push saved source code from anywhere.
- Each commit's history is tracked, and you can revert to before a specific commit if desired.
- You can compare changes between commits.
Commit: the act of recording Git changes (file creation, modification, deletion) to the repository.
Since a Jekyll blog is managed through GitHub, using Git alongside it is essential. Of course, it's possible to add, delete, and modify files in a GitHub Repository without using Git. However, this method is very inefficient for managing multiple files, and since changes to files are reflected on the blog immediately upon update, any errors will also be reflected on the blog right away. Also, since you'll inevitably be touching code while using Jekyll anyway, using an editor like VSCode will help your development environment in many ways.
Let's install Git from the Git homepage.
The Git homepage looks like the above. Surprisingly, the homepage automatically detects your OS information and recommends the most suitable version of Git for it. You can get the appropriate version from the monitor icon in the top right of the page.
Agree to the Git license. Naturally, you can't install without agreeing.
Unless there's a specific reason not to, leave the install path at its default.
Select the options to apply during installation.
- On the Desktop: create a desktop shortcut
- Git Bash Here: add a menu item to launch Git Bash from a right-click on the desktop
- Git GUI Here: add a menu item to launch Git GUI from a right-click on the desktop
- Git LFS: support for large files
- Associate .git* configuration files with the default text editor: associate git config files with the default text editor
- Associate .sh files to be run with Bash: run [.sh] files with Bash.
- Use a TrueType font in console windows: use TrueType fonts in the console window
- Check daily for Git for Windows updates: check for Git updates daily
Add or remove the options you want, then move on. It's a good idea to always include the options highlighted in blue.
Specify the name to add to the Start menu.
- Don't create a Start Menu folder: don't create a Start menu folder.
※ If you're new to Git, it's recommended to leave this setting at its default.
Choose the default editor to use with Git. The default recommended option is Vim, and you can change it to your preferred editor. The supported editors are as follows.
- Nano Editor
- Vim
- Notepad++
- Visual Studio Code
- Visual Studio Code Insider
- Sublime
- Atom
- other
※ If you're new to Git, it's recommended to leave this setting at its default.
Choose the option for setting environment variables.
- Use Git from Git Bash Only: Git can only be used from the Bash environment (no environment variable changes)
- Use Git from Windows Command Prompt: Git can be used from the Windows Command Prompt
- Use Git and optional Unix tools from the Windows Command Prompt: Git and Linux commands can be used from the Windows Command Prompt
※ If you're new to Git, it's recommended to leave this setting at its default.
Choose the HTTPS transport method to use with Git.
- Use The OpenSSH library: use the OpenSSH library
- Use The native Windows Secure Channel library: use the Windows certificate store
※ If you're new to Git, it's recommended to leave this setting at its default.
Choose how line endings are handled during Checkout and Commit operations.
- Checkout Windows-style, commit Unix-style line endings: uses Windows-style (CRLF) on checkout, Unix-style (LF) on commit
- Checkout as-is, commit Unix-style line endings: no conversion on checkout, Unix-style (LF) on commit
- Checkout as-is, commit as-is: no conversion on either checkout or commit
※ If you're new to Git, it's recommended to leave this setting at its default.
Choose the terminal to use when launching Git Bash.
- Use MinTTY: use the MinTTY terminal
- Use Windows default console window: use the default Windows terminal
※ If you're new to Git, it's recommended to leave this setting at its default.
Specify the behavior to perform when running the git pull command.
- Default (fast-forward or merge): merge using fast-forward or merge
- Rebase: merge using rebase
- Only ever fast-forward: merge using fast-forward only
※ If you're new to Git, it's recommended to leave this setting at its default.
Specify the credential helper.
Credential provides a system that stores authentication information you'd otherwise need to enter every time when using the HTTP protocol for data communication, and enters it automatically.
- None: don't use one
- Git Credential Manager: use the Windows-only Credential Manager
- Git Credential Manager Core: use the cross-platform Credential Manager
※ If you're new to Git, it's recommended to leave this setting at its default.
Choose experimental options provided by Git. These options may become officially supported or removed depending on future updates.
- Enable experimental support for pseudo consoles: virtual terminal support
Depending on your computer's specs, this may take a moment.
Installation is complete. If you check Launch Git Bash, Git Bash will launch immediately so you can start typing Git commands.
After installation, right-click on the desktop or in a folder to bring up the context menu. Depending on what you selected in Installation options, you'll see Git Bash Here and Git GUI Here. Clicking these menu items launches Bash or the GUI. Bash is a console-based interface, while the GUI is a typical program with a UI.
The picture above shows Bash; this series will describe command input using Git Bash.
Git GUI isn't used much because of Git Desktop.
Launch Git Bash. To communicate with the repository you created, you need to enter information beforehand to authenticate who you are. Enter your credential information with the commands below.
git config --global user.name "your username" git config --global user.email "your email"
Enter your username and email using the same information you entered when signing up.
