GitHub at NIT Srinagar - Veningston K - 03-06-2023
GitHub at NIT Srinagar - Veningston K - 03-06-2023
Veningston K
Computer Science and Engineering,
NIT Srinagar
[email protected]
GitHub
Computer A
Checkout
Checkout
git add
git commit
Demo
GitHub
Distributed Version Control System
git bash https://gitforwindows.org/
Git Profile
https://github.com/
https://github.com/
distributed VCS
• Local copy
remote copy Git
https://docs.github.com/en/github/authenticating-to-
github/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-
ssh-agent
SSH option
• git clone
Windows
https://docs.github.com/en/github/authen
ticating-to-github/connecting-to-github-
with-ssh/generating-a-new-ssh-key-and-
abc
adding-it-to-the-ssh-agent abc
[email protected]
• This creates a new SSH key, using the provided email as
a label.
Git Bash
Windows
[email protected]
• This creates a new SSH key, using the provided
email as a label
abc
Windows
• Start the ssh-agent in the background
Windows
https://docs.github.com/en/authentication
/connecting-to-github-with-ssh/adding-a-
new-ssh-key-to-your-github-account
ls -al ~/.ssh
https://github.com/veningstonk
Settings
Git Bash
https://github.com/veningstonk
Settings
SSH and GPG keys
Git Bash
https://github.com/veningstonk
Settings
SSH and GPG keys
• Click New SSH Key
Git Bash
https://github.com/veningstonk
Settings
SSH and GPG keys
• Click New SSH Key
Key
Add SSH key
Git Bash
https://github.com/veningstonk
Settings
SSH and GPG keys
• Click New SSH Key
Key
Add SSH key
new key
Git
repository
Java
project
• Syntax
• Example
[email protected]:veningstonk/De
mo.git
Git
repository
Java
project
• Move to a local directory
• cd e:
• cd Git\ Projects/
The Demo project is cloned from
GitHub (remote repository) to a
Working Directory
Git
repository
Java
project
• Move to a local directory
• cd e:
• cd Git\ Projects/
[email protected]:veningstonk/De
mo.git
git add
git add
git commit
working
directory
• Tracked Files
• Untracked Files
• git status
The Demo project in the Working
Directory is the same as the
Remote repository
Demo.java
Sub.java Java code directory
stage unstage
git add [followed by the changes] git reset
• git add Java\ code/
• git status
local copy
git pull
remote repository local repository
• Best Practice
remote repository
git pull
Pull Push
• git pull
remote repository
git push
remote repository GitHub
GitHub
delete local repository
remote repository
committed
uncommit
delete
• git reset --hard HEAD~1 → This will print a confirmation that HEAD is now pointing at the last previous commit.
• It will not be there in project history anymore. It is been deleted.
• Beware with uncommitting option.
Command Line Environment
GitHub Desktop https://desktop.github.com/
[email protected]