git a Clue with Revision Control

Revision Control

Remember folks, I might be able to provide a shortcut to using git revision control, but nothing beats Reading The Forgotten Manualarrow-up-right

Overview

One of the most underrated and underrepresented task in all the cyber spaces is version control/source controls. This is the practice of managing and tracking changes to your data, namely software code. A well known, popular and effective Version Control System (VCS) is something called git. A simple, easy 3 letter word that's fun to say! This is not to be confused with GitHub or GitLab, they are not exactly the same thing. GitHub, and GitLab are remote repositories (repo) and collaborative spaces built on git VCS.

Preparations

To Start we will generate a key-pair for our remote git repo to securely upload and track our files.

In the terminal of your developer system, lets first generate an SSH key for your remote repository.

# Generate a SSH Key for our remote repository. 
ssh-keygen -t rsa -C "YourCoolEmail@SomeEmailDomain.TLD"
# or 
ssh-keygen -t rsa -C "YourCoolGitUsername"
# Enter a passphrase or leave it blank. 
# Enter path and file name i.e ~/.ssh/rsa_GitHub

# Adjust your ssh keys and directory. 
# Set ownership
sudo chown -R $USER:$USER ~/.ssh

# Set directory and file permissions
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa            # Private key
chmod 644 ~/.ssh/id_rsa.pub        # Public key
chmod 600 ~/.ssh/authorized_keys   # If present locally
chmod 644 ~/.ssh/config            # Optional, if using SSH config

# Print the PUBLIC key
cat ~/.ssh/rsa_GitHub.pub

Next, we will need a remote git repo. Open your default browser and log into or create yourself an account in GitHub, GitLab or any other remote hosted repository.

Import your ssh PUBLIC key into the remote repository account we created. Create a new empty repository

Testing SSH to Git Repo

Configure your Local Git

When executing a clone, or push via ssh you will be prompted to enter a username and maybe a password. This will update the global config but we can adjust or pre-configure with the following

Using Git

References

Last updated