Git advanced command (3) Git remote warehouse operation

Git remote repository

1. What is a Git remote repository?
write picture description here
The remote warehouse is convenient for team development. As shown in the figure, when A uses push to submit a project to the remote warehouse, B can clone the project from the remote warehouse. After A submits the project, B improves the project and resubmits the project to the remote warehouse with push. , then A can use pull to pull back the project, and the project at this time is the project that B has completed.
2. Use the github remote repository
to create our repository on github. If you don't know how to create it, please refer to the link:
http://blog.csdn.net/lg_49/article/details/78127319
3. Submit the local project to our Remote warehouse
Use the git push remote warehouse address current branch name command, as shown in the figure
write picture description here
4. How to use the ssh public key to pull back the project or submit the project
Log in to the GitHub official website, select the project, and click write picture description here
to display the SSH selection interface, as shown in the figure:
write picture description here
Select Use SSH, copy the new address
write picture description here
5. Pull the project back from the remote warehouse
Use the git pull remote warehouse address branch name command, as shown in the figure:
write picture description here
Description: This means that B pulls the project back to the local, the method used here is the SSH public key method
The situation shown in the figure above occurs, this is because we did not set the ssh public key generated by our machine to our github
6. Generate the ssh public key
using the ssh-keygen command, who uploads the project, where and where to generate the ssh public key, As shown in the figure:
write picture description here
We find our public key through the address:
write picture description here
copy the content of the public key, open our github website
to find thiswrite picture description hereClick on open, select setting, and select after soft selection. After
write picture description here
selecting SSH keys ,
write picture description here
B can use the git pull command to clone the project. 7. Rename the address of the remote warehouse and use git remote add new name (eq:github) Remote warehouse 8. View the remote address with the same name Use the git remote -v command, as shown in the figure: In this way, we do not need to enter a long remote warehouse address when submitting or pulling projects in the future. For more knowledge about remote warehouses, you can check the link: http://blog.csdn.net/lg_49/article/details/78127849
write picture description here



write picture description here


write picture description here


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325502037&siteId=291194637