I began my GitHub journey with GitHub Desktop, a Git GUI client for Windows users. Recently, I switch to Git and find it worth to invest some time in learning it by using.
Quick Start for Git in Windows
Download and install Git via this link https://git-scm.com/downloads
Connect to GitHub using SSH keys
With SSH keys, we can connect to GitHub without supplying your username and personal access token at each visit.
Learn more about SSH
Check for existing SSH keys
Instruction page from GitHub Docs
Novice Note:
- The physical directory in Windows is
C:\Users\<user name>\.ssh\
, where.ssh
is a hidden folder by default - Generate a new SSH key if needed
- The physical directory in Windows is
Add your SSH to the local ssh-agent and your GitHub account
Novice Note:
Use Git Bash to start the ssh-agent in the background. Command Prompt does not recognize
eval
command.1
2
3# start the ssh-agent in the background
$ eval $(ssh-agent -s)
> Agent pid <your pid number>Go to your GitHub setting page and follow this instruction from GitHub Docs
Test the SSH connection
1
2$ssh -T git@github.com
> Hi <GitHub username>! You\'ve successfully authenticated, but GitHub does not provide shell access.
Start a project with GitHub using the command line
Instruction page from GitHub Docs
Novice Note:
We can interchangeably use Git Bash and Command Prompt in Windows
My colleague suggests me use SSH instead of HTTPS when adding the URL for the remote repository
1
2
3
4# Sets the new remote
$ git remote add origin <remote repository SSH URL>
# Verifies the new remote URL
$ git remote -vWe can give a name to the origin branch
1
2# Pushes our local repository up to the remote repository we specify as the origin
$ git push origin <branch name>
Git Reference
Cheat Sheet: https://training.github.com/downloads/github-git-cheat-sheet/
Video Tutorial: https://git-scm.com/videos
Documentation: https://git-scm.com/docs
My colleague, Jianghao, shares his note on using Git via this page: https://jianghaochu.github.io/version-control-with-git.html
View / Make Comments