In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "how to use origin in git". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to use origin in git" can help you solve the problem.
In git, origin means "remote repository", which is the alias of a remote repository link. When clone hosts a code base on Github, git creates a label that points to the remote code base by default, and origin points to the version of the local code base hosted on Github.
This article operating environment: Windows10 system, Git2.30.0 version, Dell G3 computer.
What does origin mean in git
Your code base (repository) can be stored on your computer, and you can also host the code base on Github's server.
By default, origin points to the version of your local code base hosted on Github.
Let's assume that you first create a Repository on github, called repository, and suppose your Github ID is user1, and the link to your code base is
Https://github.com/user1/repository
If you type in terminal
Git clone https://github.com/user1/repository
Then git will locally copy a code base hosted on github
At this time, you cd to repository.
Then enter
Git remote-v
You will see the console output
Origin https://github.com/user1/repository.git (fetch) origin https://github.com/user1/repository.git (push)
In other words, git creates an origin pointing to the remote code base for you by default (because you came down from this address clone)
And suppose there is a user user2 fork, your repository, then his code base link looks like this.
Https://github.com/user2/repository
If he also follows this clone, and then enter it in his console.
Git remote-v
What he will see is
Origin https://github.com/user2/repository.git (fetch) origin https://github.com/user2/repository.git (push)
The origin that you can see points to the remote code base of user2.
At this time, if user2 wants to add a code base that points to you remotely, he can enter it on the console.
Git remote add upstream https://github.com/user1/repository.git
Then type git remote-v again
The output will become
Origin https://github.com/user2/repository.git (fetch) origin https://github.com/user2/repository.git (push) upstream https://github.com/user1/repository.git (push) upstream https://github.com/user1/repository.git (push)
Added a upstream pointing to the user1 code base, that is, the previous naming of the pointing location.
To sum up, as the name implies, origin is a name. When you clone a code base hosted on Github, git creates a tag that points to that remote code base for you by default.
This is the end of the content about "how to use origin in git". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
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.