Version Control
Git
Git is a distributed version control system widely used for source code management. It is designed to handle everything from small to huge projects with speed and efficiency.
Git Configuration
The git config
command is a convenient way to set configuration options that control all aspects of how Git operates. These configuration options are stored in three different places, each with a different scope:
System-level (--system): These options are applied to every user on the system and all of their repositories. They are stored in the
/etc/gitconfig
file. If you pass the--system
option to git config, it reads and writes from this file specifically.Global-level (--global): These options are applied to all repositories of the current user. They are stored in the
.gitconfig
or.config/git/config
file in the user’s home directory. If you pass the--global
option to git config, it reads and writes from this file.Local-level (--local): These options are applied to the current repository only. They are stored in the
.git/config
file in the repository’s root directory. If you don't specify a level when using git config, this is the default scope.
Each level overrides the values from the previous level, so options in a repository's .git/config
file override those in the user's .gitconfig
file, which in turn override those in the /etc/gitconfig
file.
Here's an example of how to set the username at different levels:
System-level:
sudo git config --system user.name "System User"
Global-level:
git config --global user.name "Global User"
Local-level:
git config --local user.name "Local User"
To see the origin of your configuration, you can use the git config --list --show-origin
command.
My Git Configuration
System-level Configuration
Install GitHub CLI tools
GitHub CLI brings GitHub to your terminal. It enables you to perform many of the same actions you would on GitHub.com, but directly from your terminal.
Act is a tool that runs your GitHub Actions locally. It is a single binary that is straightforward to install and run.
Ruby
Ruby is a dynamic, open-source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.
RVM
Install GPG keys:
Install RVM:
Install Ruby:
Jekyll
Jekyll is a simple, blog-aware static site generator that is ideal for personal, project, or organization sites. It is written in Ruby and requires the RubyGems package manager.
At the root of the project create a Gemfile
with the following content:
Update RubyGems and Bundler, ensure that you have the latest versions of RubyGems and Bundler. Avoid using sudo when installing gems. If you encounter permission errors, you can use the --user-install
flag.
Clean the Bundler Environment, remove any existing Gemfile.lock
file and clean the Bundler environment.
Configure Bundler to install gems in a specific directory vendor/bundle
within your project.
Install Dependencies, reinstall the dependencies specified in your Gemfile.
Export to PATH in .zshrc
or .bashrc
:
Verify Installation, check the installed versions of Jekyll and Bundler.
Build the Jekyll site:
Serve the Jekyll site:
Now, go to http://localhost:4000
to see the site.
Keyring
Keyring is a secure way to store credentials for Git. It is a daemon that stores passwords and other sensitive information in encrypted files using the Secret Service API.
SSH Key Generation
SSH keys are a pair of cryptographic keys that can be used to authenticate to an SSH server as an alternative to password-based logins. One key is private and kept secure on your machine, while another is public and shared with the server.
Check the agent is up and running
Then add it to the ssh-agent
GPG Key Generation
GPG keys are a pair of cryptographic keys that can be used to sign and encrypt data. One key is private and kept secure on your machine, while another is public and shared with the server.
Follow the default options (RSA, 4096 bits). Input your personal information: name, email, and passphrase.