Installing Git & Setting Up Your GitHub Account

Installing Git & Setting Up Your GitHub Account


Here’s a guide to installing Git and setting up your GitHub account:

i. For Linux using Package Manager:

  • Open Terminal.
  • For Debian-based distributions (e.g., Ubuntu):
sudo apt-get update
sudo apt-get install git -y
Enter fullscreen mode

Exit fullscreen mode

  • For Red Hat-based distributions (e.g., Fedora):
sudo dnf update
sudo dnf install git -y
Enter fullscreen mode

Exit fullscreen mode

ii. Verifying Git Installation:

  • Open Terminal and type the following command and press Enter:
git --version
Enter fullscreen mode

Exit fullscreen mode

  • We should see the installed version of Git displayed.

iii. Configuring Git for the first time:

  • Setting up Git with our identity:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
Enter fullscreen mode

Exit fullscreen mode

iv. Verifying the configuration:

git config --list
Enter fullscreen mode

Exit fullscreen mode




V. Setting Up Your GitHub Account


i. Visit GitHub:

ii. Sign Up:

  • Click on the Sign up button located at the top right corner of the page.

iii. Create Account:

  • Enter your email address, create a password, and choose a username.
  • Verify your email address by clicking the link sent to your email.
    Email

iv. Personalize Account:

  • Optionally, fill out additional information like whether you want to receive updates from GitHub, and set your preferences.
    Finalize

v. Finish Setup:

  • Complete the CAPTCHA to verify you’re not a robot.
  • Click on Create account.
    Captcha

vi. Choose a Plan:

  • Select the free plan unless you need the features of a paid plan.

vii. Setup:

  • Follow the on-screen instructions to set up your profile and preferences.




VI. Create Your First GitHub Repository


i. Create GitHub Repository:

  • Log in to GitHub
  • Click on the + icon in the top right corner / select Create Repository.
  • Fill in the repository details (name, description, visibility, README) and click Create repository.
    repo
    repo2

ii. Clone the Repository to Your Local Machine:

  • Open Command Prompt or Terminal.
  • Clone the repository using:
git clone https://github.com/your-username/my-first-repo.git
Enter fullscreen mode

Exit fullscreen mode

  • Navigate to the repository directory:
cd my-first-repo
Enter fullscreen mode

Exit fullscreen mode

clone

iii. Create and Add a New File:

  • Create a new file in the repository directory:
echo "Hello, World!" > hello_world.txt
Enter fullscreen mode

Exit fullscreen mode

  • Add the file to the staging area:
git add hello_world.txt
Enter fullscreen mode

Exit fullscreen mode

iv. Commit Your Changes:

  • Commit the changes with a descriptive message:
git commit -m "Add hello_world.txt"
Enter fullscreen mode

Exit fullscreen mode

v. Push Your Changes to GitHub:

  • Push the committed changes to your GitHub repository:
git push origin main
Enter fullscreen mode

Exit fullscreen mode




Git – GitHub: How it works


Git cmds



Key Concepts:

Working Directory: The local directory where you make changes to your files.
Staging Area: An intermediate area where you prepare changes before committing them.
Local Repository: The versioned history of your project stored on your local machine.
Remote Repository: A versioned history of your project stored on a server, accessible over the internet.



Git Commands

git add: Adds changes from the working directory to the staging area.
git commit: Records the staged changes in the local repository with a descriptive message.
git push: Sends committed changes from your local repository to a remote repository.
git fetch: Retrieves updates from the remote repository without merging them into your local branch.
git merge: Combines changes from different branches into your current branch.
git pull: Fetches updates from the remote repository and merges them into your local branch.
git clone: Creates a local copy of an existing remote repository.
git checkout: Switches to a different branch or restores files to a previous state.

Additional resources and references for further learning.
Git Documentation Here
GitHub Documentation Here



Source link
lol

By stp2y

Leave a Reply

Your email address will not be published. Required fields are marked *

No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.