- Create a new directory where you can create a specific Git username and mailbox
$ git config user.email "[email protected]"
$ git config user.name "as_tgl"
Copy the code
- Example Create an SSH key
$ ssh-keygen -C "[email protected]"
Copy the code
Enter the file name for the new key after this prompt (you can also specify a specific file path)
Enter file in which to save the key (/Users/as_tgl/.ssh/id_rsa): id_github_rsa
Copy the code
3. Upload the key to Github to obtain the generated public key
$ cat ~/.ssh/id_github_rsa.pub
Copy the code
In github.com/settings/ke… Create an SSH Key. Paste the public key you generated into it. 4. Configure the local SSH configuration information
$ vim ~/.ssh/config
Copy the code
You need to specify a specific private key to connect to GitHub.com when sending a request
Host github.com
HostName github.com
User git
IdentityFile /Users/as_tgl/.ssh/id_github_rsa
IdentitiesOnly yes
Copy the code
2. Clone your warehouse with a special private key to make git connections when the branch is pulled. (๑• ㅂ•́)و✧
$ git clone [email protected]:Veming/algorithm008-class02.git
Copy the code