Github
This is a web-based platform that helps users store, manage, and collaborate on software projects.
Importance of GitHub:
Collaboration:
Multiple people can work on the same project without overwriting each other’s work and with full visibility. Team members can view real-time updates, contribute changes, and communicate through repository file.Code Storage & Backup:
GitHub acts as a cloud-based repository where your code is safely stored and accessible from anywhere. This minimizes the risk of thePortfolio & Career Growth:
Projects that are worked on GitHub can serve as a portfolio to showcase one's skills to potential employersOpen-source code contributions:
GitHub contains numerous codes that are freely available and can easily be modified, integrated, and incorporated into other codesVersion control:
GitHub allows one to track and manage changes made to code.
Creating a GitHub account
- Visit the official GitHub site
- Click on Sign In >> Continue with Google
- Choose your email and username
- Click on create account >> Adjust your profile details and save
Git (Git Bash)
Git is a version-control system, whilst Git Bash is a commanding system that helps a user to communicate lines of code from their local machine and their web-based GitHub account.
Git installation:
Head to the Git official website
Install the application; ensure you install an app that is compatible with your operating system.
Connecting Git Bash to GitHub
A successful connection is determined by a couple of steps undertaken in the sequence shown below:
Configuration
git config --global user.name "Your Name" - This command is meant to help set up your username
git config --global user.email "your.email@example.com"- This command is meant to help set up your email address
git config --list - This command is meant to verify your configuration
Generating SSH Key
Run this command to check for existing keys
ls -al ~/.ssh
If you see files named id_ed25519 and id_ed25519.pub (or id_rsa and id_rsa.pub), you have an existing key pair. If not, you'll need to generate oneGenerate the SSH key by running this command:
ssh-keygen -t ed25519 -C "your_email@example.com"
In this step, one will be prompted to save the key. It is paramount that they save it in a file location that one can easily remember and retrieve from
Starting SSH agent
- To start the SSH agent, run this command:
eval $(ssh-agent -s)This command varies based on the user's operating system
-Add your private key to the running ssh-agent
ssh-add ~/.ssh/id_ed25519
Adding the key to Git account
- Copy your public key to the clipboard
- Open the GitHub platform online
- Click on Profile >> Settings
- Click on SSH and GPG keys
- Add new SSH key >> paste the copied key on the clipboard
- Test the connection
Common terminologies
- Pushing code - uploading changes from one's local machine to GitHub
- Pulling code - downloading changes from GitHub to a local machine
- Command lines - giving instructions to the system through codes
- Version control - tracking and managing changes to code on GitHub
- Repository (Repo)- storage space for project file and code
Common command lines:
git --version - This helps check the Git Bash version
mkdir "Name of the folder" - Creating a folder within GitHub on GitBash
cd "Created Folder - This is used to change the directory to the folder that was created. All commands that follow this command are within the specifically mentioned folder
touch "Name of file"- This helps create a file within a folder. You should specify the type of file you want to create i.e .py READ.Me
git init - This initializes a new repository which holds the files containing the codes
Top comments (0)