For a data engineering and data science student knowing about git and github is mandatory. Git helps us collaborate with others who we share common interests with. It also helps us track changes in you code and avoid losing your work.
What is git
Git is an open-source version control system that tracks changes made to your files over time, allowing you to go back to a previous version in case of any mistake
What is github
Github is a cloud-based platform where developers store, manage and share their software code.
step 1:Install git bash
- Install git
- Run installer
- Finish installation
verify installation
git --version
Step 2:Setup git
git config --global user.name "Your Name"
git config --global user.email "your_email@example.com"
Confirm configuration
git config --list
Step 3.Connect git bash and github through SSH key
ssh-add ~/.ssh/id_ed25519
Add SSH key to github
- Go to Github
- Go to settings
- Click SSH key
- Click new SSH key
- Paste the key and save
Test connection
ssh -T git@github.com
Step 5.Clone repository
git-ssh-practice.git
Go to project folder
cd git-ssh-practice
Step 6.chek changes with git
Check status:
git status
Add files
git add .
Step 7. Push code to GitHub
Connect local repository to GitHub
git remote add origin https://github.com/username/repository-name.git
Push code
git push -u origin main
Now your code is active on GitHub
Step 8. Pull code from GitHub
This is advisable while working with multiple machines or while working with a team.
git pull origin main
This collects latest changes and updates your local files.
Top comments (0)