Git local environment configuration
1. Install GIT
sudo apt-get install git
2. Configure user information
$ git config --global user.name "Your Name"
$ git config --global user.email [email protected]
3. Initialize local warehouse configuration
git init
Connecting GitHub via SSH
1. Install SSH
sudo apt-get install ssh
First, SSH keygen confirms the storage location and file name of the key (default is. SSH / ID_ Then he will ask you to enter the key password twice and leave it blank. Therefore, generally select the default, all enter can be.
2. Create key file
Ssh-keygen - t RSA - C "your GitHub account email"
The default key file path is in~/.ssh
,id_rsa
Is a private key file,id_rsa.pub
Is a public key file
3. Add the public key to GitHub
- take
id_rsa.pub
Copy all the contents of the file - Log in to GitHub and click New SSH key in the small avatar > setting > SSH and GPG keys in the upper right corner.
4. SSH test
ssh -T [email protected]
If the result is “… You’ve successfully authenticated, but GitHub does not provide shell access”, then it is successful.
5. Set up remote warehouse
git remote add origin [email protected]:Username/Repositories_Name.git
If the hand is wrong, you can use thegit remote remove origin
Command to delete the remote warehouse.
6. Final test
- Create changes locally
git add xxx
git commit -m "xxxxxx"
git push origin master
OK!