Git Basics
Some basics about Git and GitHub.
Although there are many tutorials online, I still want to record some of them here for my own reference.
Some References
- Git and GitHub (Concise)
- Git 与代码管理 (Good!)
Configure Git
|
|
NOTE: your_email@@youremail.com
should be the noreply
email address of your GitHub account.
Git Clone
|
|
SSH Config for GitHub
Check for existing SSH keys
First check for existing SSH keys on your computer by running:
|
|
Check the directory listing to see if you have files named either id_rsa.pub
or id_dsa.pub
. If you don’t have either of those files then read on, otherwise skip the next section.
Generate a new SSH key
-
Open Terminal.
-
Paste the text below, substituting in your GitHub email address. This creates a new ssh key, using the provided email as a label.
1
ssh-keygen -t ed25519 -C "your_email@example.com"
Add your SSH key to the ssh-agent
-
Start the ssh-agent in the background.
1
eval "$(ssh-agent -s)"
-
Add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_ed25519 in the command with the name of your private key file.
1
ssh-add ~/.ssh/id_ed25519
Test SSH connection
|
|