Git and GitHub are free and open-source distributed version control systems. GitHub hosts a remote repository and provides a Web interface. There are two protocols that support pushing code locally to a remote repository. One is HTTP. You need to enter the user name and password. The other is ssh. If you upload the public key to GitHub, you do not need to enter the password each time. The configuration process is as follows: 1. Configure the user name and email address?
git config --list git config --global user.name "xxx" git config --global user.email "[email protected]"
If you have no user name or email address, configure it first. 2. You need an SSH key and GitHub account. The SSH key is local, and GitHub is a remote server.
Cd ~ /. SSH # Check whether the local machine has an SSH key. If the directory exists, it indicates that the local machine has an SSH key ssh-keygen-t rsa-c "email" #-T indicates the encryption method, RSA and rsa1 are available. DSA and ECDSA are optional. Generally, RSA #-C is the annotation.
If the local machine does not have an SSH key, generate an SSH key. The generated. Ssh folder contains two files: id_rsa and id_rsa.pub, respectively storing the private key and public key. If you do not have a GitHub account, register with the Web Client. 3. Upload the Local Public Key to GitHub. On the remote page, locate 4 to test whether the configuration is successful.
Ssh-T [email protected] # [email protected] is fixed, followed by the GitHub address, depending on your individual circumstances
Check whether the configuration is successful. How does git view the remote repository address?
Git remote-V or CD. Git cat config
How does git set the address of the remote repository? Example:
git remote set-url origin [email protected]:someaccount/someproject.git
Git and GitHub