UPLOADING & CLONING ON GITHUB
Here, we are going to learn how to upload and clone a project using command lines on GitHub.
The IDE being used here is VS Code.
Table of contents:
- Introduction
- create a repository
- command lines in VS Code
- clone a repository
Introduction
GitHub is a powerful platform that empowers developers to collaborate, store, manage code, and contribute to open-source projects.
Here are some key things you can do with GitHub:
- allows one to track changes in one's code across different versions - one can commit changes, create branches, and merge them back together.
- create repositories (or “repos”) on GitHub to store your code.
- Multiple people can work on the same project simultaneously without conflicts.
- GitHub includes a wiki and an issue tracker, making it easy to create in-depth documentation and receive feedback about your project.
Create a repository
To get started, open your GitHub account and sign in.You will see an interface like the one below:
- Click on "New repository"
- Enter a suitable name for the repository and a description (optional) to describe the purpose of the repository.
*Mine is "Lab sheet answers" and a brief description of what is going to be uploaded in this repository.
- Click on "Create repository"
After successfully creating a repository, you will find this code list appearing on your GitHub account.
Below are some instructions used in GitHub:
Push - Add the local repository to the remote repository.
Clone - Make a copy of the remote repository to local machine.
Pull - keep the local repository up to date with changes from a remote repository.
Commit - keeps track of changes that happened to one or more files in the repository.
Project to upload
Now, prepare a project to be uploaded in the repository on the GitHub account.
STEPS:
- Click on "Terminal"
(This is where we are going to use the command lines to upload the project selected in the repository created on GitHub)
Command lines in VS Code
Follow the steps below by typing the code lines in the terminal:
- git commit -m "ENTER A COMMENT HERE" // Save the files to the local repository.
- git branch -M main
- Upload the file to our remote repository using this line of code.
*Found in the GitHub where you just created the new repository
- git push -u origin main //upload the local repository to the remote repository.
Now, go to GitHub and find all the files successfully uploaded on the repository!
Clone a repository
- Go to a repository
- Click on "Code"
You can clone a repository in three ways:
- Https
- SSH
- GitHub CU
For a quick tutorial, I will be using HTTPS.
- Copy the link where the arrow is found.
git clone link
Comments
Post a Comment