In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
What is the difference between git pull and git clone, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
This article brings you the knowledge about the difference between git pull and git clone in Git tutorials. I hope it will be helpful to you.
On the Internet, many people explain the difference between pull and clone, saying that pull is an update of local code and clone is a local process from scratch, but there is one point not mentioned. I happen to have made this problem again today, because I used to pull directly from a remote warehouse. Today, I suddenly found that pull can not be used, clone is effective, I am aware of this problem. Decided to take notes.
1 git pull
Git pull is suitable for pulling code from a repository where the user has permission, regardless of whether there is local code or not.
Because I usually drop down the code is a direct git pull.
1.1 I have access to the warehouse
The warehouse I have access to refers to my own warehouse, or the warehouse that I can use in the team.
To use git pull, you first need to make sure that the remote repository is connected. Otherwise, if you git pull orgin master directly, the Github will ask you, "what master? which master? are you my master?"
So the first thing to do is to connect to the remote warehouse.
Init initializes a blank local repository with nothing but .git
Connect to the remote warehouse
1.1.1 No local code
Git remote-v is used to display remote repositories that are currently connected to local warehouses, and you can connect several. Then a warehouse exists in pairs, one uploading and one drop-down. The front origin I generally call the remote warehouse proxy, the back is your connection method.
Now it shows that I am connected to a remote repository of github named origin.
Blank warehouse directly use git pull to drop down the code.
1.1.2 there is local code
What happens when there is code locally.
Teamwork, multiple users in one warehouse
Your own warehouse, which you use on multiple computers (such as one in the dormitory, one in the laboratory)
Why git pull? The version of the code varies from computer to computer. So in order to reduce work and ensure that the code version is consistent, drop down the code each time you write the code. Push to the remote warehouse after writing. Draw a picture and explain it.
1.2 I don't have access to the warehouse.
An unauthorized warehouse refers to someone else's warehouse. If other people don't give permission, of course you can't modify their code at will.
Git pull cannot be used in repositories without permission. For example:
Today, I went to download the code as usual. But this is the first time I have downloaded someone else's code.
I added the warehouse link, git pull drop-down as usual. But he reminded me:
Permission denied (publickey).
Fatal: Could not read from remote repository.
Please make sure you have the correct access rightsand the repository exists.
Permission denied means that the SSH key cannot be used, so let me confirm whether I have permission to access or if the repository exists.
The warehouse does exist. So it must be that I don't have access.
Explain the three steps:
Add remote repositories and connect with SSH
Drop down the code from the warehouse master branch
Delete the remote warehouse I added (since I can't use it, of course I deleted it)
Then I remembered: SSH can only be used by warehouse owners. Because the SSH configured on your computer is paired with the SSH on your github, you can use SSH only if you use your github repository on your computer.
Since only the warehouse owner can use SSH, I'll just switch to HTTP. (I don't realize the seriousness of the problem at this time.)
I added the https connection again.
In the second step, I dropped down the warehouse.
Then he reminded me:
Fatal: unable to access' github.com/hitvoice/Dr...' : OpenSSL SSL_read: Connection was reset, errno 10054
It still means I can't connect.
Then I suddenly realized the problem: neutral_face:. This looks like someone else's warehouse. I can't use remote to connect to a remote warehouse and drop it down. Because if I can connect, it means I can modify other people's code at will. So I certainly can't use pull code in this way!
So you have to use git clone.
2 git clone
Git clone applies locally without code that you want to download. You don't even connect to the remote warehouse. With or without warehouse access.
After realizing the use of git clone, I deleted the HTTPS to connect to the remote repository, then git clone directly, and the code was downloaded successfully.
I deleted the https method above to connect to the remote warehouse
Git remote-v is used to check which remote warehouses are connected to your local warehouse. If connected, the warehouse code and connection method will be displayed. I output a blank here, that is, the status of no remote warehouse is connected.
Git clone downloaded the code successfully.
What it says above is someone else's warehouse, what if it's a warehouse that I have access to?
Build a new local warehouse. It was obviously a success. If SSH can succeed, then HTTPS will succeed. If you can succeed without remote, you will succeed even if you use remote.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.