Git & GitHub
/Beginner
Repositories
Definition
A repository (or 'repo') is the most basic element of GitHub. It is a place where you can store your code, your files, and each file's revision history.
Explain Like I'm New
A project folder in the cloud. Every distinct project you build gets its own Repository. A repository contains all your folders, files, images, videos, spreadsheets, and data sets, along with the Git history.
Real World Example
Creating a repository named 'my-portfolio-website', uploading your HTML/CSS files to it, and setting it to 'Public' so employers can review your code.
Common Use Cases
- •Organizing projects
Terminal Output
bash / terminal
// Steps to connect a local folder to a new GitHub Repository:
/*
1. Go to github.com and click 'New Repository'. Name it 'my-app'.
2. GitHub gives you a URL: https://github.com/user/my-app.git
3. Open your terminal in your local project folder and run:
*/
$ git init
$ git add .
$ git commit -m "First commit"
# Tell local Git where the cloud repository is
$ git remote add origin https://github.com/user/my-app.git
# Upload the code!
$ git push -u origin main
Interview Questions
basic
- What is the difference between a Public and Private repository?
intermediate
- What is the repository limit for a free GitHub account?