Git clone Operation implementation
Today we are going to discuss how to use the Git operation, to further implement the download of the code to the local, I did not quite understand the role of the public key and private key in Git, I have been thinking, git inside you send your own public key to the GIT server, how he judged, every time I change the system, In the re-installed, he is how to determine whether to change the system or still can use Git, today we will explain the simplest method of SSH operation of the clone project:
1. Download the git client (upload&download only)
2. No brain installation
3. Open git Bash and generate a new secret key:
$ ssh-keygen-t Rsa-c "your email address"
Now we are emphasizing that if we do not write the address of the mailbox, then we in the back of the Git clone code, he will be wrong, error is always prompt me to enter the password, the original generated. After the folder in SSH is deleted, it can be
4.git Clone
before we do clone, we need git init to initialize the GIT repository
At this point, when we provide our public key to the administrator, we can then download the project from the remote repository from the server to the native
$ git clone < repository address > "Address to store after download"
This time can be prompted, if the git address is shaped like http://xxx, this is the way to use HTTP, not suitable for our SSH public key method, if it is git. @gitxxx. Git this way, it's ssh.
Questions and Answers:
Where is the public and private key of 1.git stored?
When I pass the above step 3, generate the public key and private key, in fact, each public key corresponds to a private key, the equivalent of the key and the suo relationship, a key can open a lock, a public key to match a private key, then the public key and the private key generated address is determined, are in: C:\Users\xxx\. SSH inside, if it is xxx.pub this is the public key, then xxx This is the private key, this address will not change, so the server matches our private key when, directly to this address on the line, so when we change the system, each time we put this backup, the next time directly covered this place on the line.
2. What is the purpose of this public and private key?
Public key We are generally to the server, they will be in the permissions to add the public key I gave, and then when I download the project from the remote repository, I am in git clone xxx, the server I through his binding public key to match my private key, this time, if the match, then you can download the normal, If it does not match, it fails.