GitHub is a web-based platform for version control and collaboration that allows developers to host and review code, manage projects, and build software together. Some key features and aspects of GitHub are version control, repositories, branching and merging, pull requests e.t.c.
Setting up on Git involves a few steps. Here's a guide to help you get started:
1. Install Git
Windows: Download and install Git from git-scm.com/downloads
2. Configure Git
After installing Git, you need to set your username and email:
Open Git Bash
Then to setup your username and email,
Enter git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"
3. Create a Repository
Initialize a new repository:
To create directory: mkdir Gitlab
To change directory: cd Gitlab
Type
- mkdir my_project
- cd my_project
- git init
To open Vscode (Visual Studio Code)
- code . This opens visual studio code automatically. Create a new file from Gitlab, name it "index.html"
Enter as seen below:
<!DOCTYPE html>
Hello world!
Hello world!
This is the first file in my new Git Repo.
Then Go to terminal - it can be used on Gitbash or Vscode.
From Vscode- Click on the three dot
Then click Run - Click Terminal
Click New Terminal
4. To add files to the repository:
- git add .
- git status
5. Commit Changes
Commit your changes with a message:
git commit -m "Adding index.html"
To create a repository: Go to gitlab.com
Connect the repository on gitbash
To push the origin master - Click +, the drop down
Click on New repository
Enter name - Gitlab
Check Readme, Click Create Repository
Then click on code.
Copy the url
Then back to Vscode
Type git remote add origin (url)
Example git remote add origin https://github.com/Abidemimodupe/GitLab.git
Connect to a remote repository and push changes:
git remote add origin https://github.com/username/my_project.git
git push -u origin main
With these steps, you should have a Git repository set up and ready to use.
Top comments (2)
Nice informative introduction to Git and Github!
Thank you.