Git commands are not here to say, beginners click http://www.cnblogs.com/Vdiao/p/5267250.html
Git is a distributed version control system, and the same git repository can be distributed across different machines. This is often the case, find a computer to act as a server role, 24 hours a day to power on, everyone else from the "server" to clone a copy to their own computer, and their respective submissions to the server warehouse, but also from the server warehouse to pull someone else's submission. This is what git does as a collaborative development.
Take GitHub, for example, to register a GitHub account with GitHub as a remote repository, and the rest as Gitlab.
1. Create SSH KEY
Ssh-keygen-t rsa-c "[email protected]"
Lui @desktop-ghl1s3q/d/Test (Master) $ ssh"[email protected]"public /Private in which to save the key (/c/users/lui/.ssh/id_rsa):
The default key will be generated in the. ssh file below the C-drive user to copy the contents of the Id_rsa.pub file, then add SSH key to the remote library, such as GitHub, and then copy the secret key from the name. :
So the secret key is created, the function of the key is that GitHub needs to recognize that you push the submission is really you push, not others impersonating, and git support SSH protocol, so, as long as the GitHub know your public key, you can confirm that only you will be able to push.
Of course, GitHub allows you to add multiple keys. Assuming you have a number of computers, you can submit them at the company in a moment, and at home, just add each key to GitHub and push it to GitHub on every computer.
2. Create a library:
3. To have your local and remote libraries associated, the commands are:
Lui @desktop-ghl1s3q/d/Test (Master) $ git remote add originTest2 https://github.com/smithwenge/ Test.git
Or
Lui @desktop-ghl1s3q/d/Test (Master) $ git remote add originTest2 [email protected]:smithwenge/test.git
This allows the remote library to be built. You can then either push or pull, upload your code to the remote or get the modified code from the remote.
4. Push all the contents of the local library to the remote library:
Lui @desktop-ghl1s3q/d/-u origin-graduate Master
Since the remote library is empty, the first time we push master a branch, with -u parameters, Git will not only master push the local branch content of the remote new master branch, but also the local master branch and the Remote master Branch Association, Simplify commands at a later push or pull to write git push # # # Master directly
This local library code is pushed to the remote library.
5. Clone the remote Library's code to a local library
git clone https://github.com/smithwenge/test.git
Lui @desktop-ghl1s3q/d/Workplace (master) $ git clone https://Github.com/smithwenge/test.gitCloning into'Test'... remote:counting objects:6, done.remote:Compressing objects: -% (2/2), Done.remote:Total6(Delta0), reused6(Delta0), pack-reused0Unpacking objects: -% (6/6), done. Checking connectivity ... done.
This allows the remote library's code to be cloned into a local library.
This is the most basic git operation is these, the author is also a beginner, welcome to Daniel, welcome to exchange with classmates!
Git Remote library commands