Hello,
Please someone explain to me exactly what remote git is (in simple language)
And what is its role and why should we use it?
The next question what is (origin)?thanks
"remote" is just some git repository not on your computer (e.g. on GitHub).
"origin" is the repository you cloned your repository from (e.g. the one on your GitHub).
"master/main" is just the name of the default branch. It's called "master/main" because generally it's the branch that represents production code, and all other branches come from and generally eventually rejoin.
Not sure where "gate" comes in. But a git remote is a remote repository where the files are stored. Often people use github.com for this (I do so myself). So you tell git, that when pushing or pulling changes, that remote is the server that has the data. And origin is just a name we give the main one. In theory you can have more than one remote if needed. When I migrated to github myself, I set up multiple remotes to get my data in sync, and then when I was done I set github to origin
@Sinnbeck What I have found so far is that:
When we create a repository, there is no remote git.
When we clone a repository
There is a remote called (origin),
My question is, what does remote mean?
And why would we need a remote?
And what is the use of it completely?
In some projects, I have seen several remotes, why is it like this?
I am very new to git
@johnDoe220 Lets start with a new repository as an example.
You create a new one and there is no remote.. All is good. You work alone and track changes locally in git.
Now a month goes by and your computer dies.. Now all of your code is gone forever.. (Yes you could just back it up.. but wait for 2 and 3). Had the code been on a remote server you could just get it back with a git clone on a new pc.
You start working with someone one the same project. Now how will you merge your changes ? Will the new person need to get access to your computer to edit the code? No of course not. If the code is on a remote you can both push and pull changes from that server.
You go live. Now the server needs the code.. Do you upload it with ftp every time? We are using git here! :) So just have it pull the code from the same remote server
@Sinnbeck So you mean to access the repository
from anywhere
and synchronizing it with the repository on the personal computer
Is the remote used?
(In fact, it is similar to a connection from local to a cloud space).
If so, why do some projects have multiple remotes? What does it mean?
But what is origin?
@johnDoe220 Yes a remote is as the name implies, remote (eg. not local). Most use github.com or gitlab.com or similar. (those are git servers with a nice webinterface on top).
And I think i already answered both of those above ? Lets just quickly cover them again
Why use more than one remote. I personally used to run my own gitolite server (selfhosted git server). But one day I decided to move to github. So I added github as a second remote. Then I would work with both while trying to get my repo working correctly on github. So I had origin which pointed to gitolite and remote which pointed to github.com. And after I was done, I changed origin to point to github.com and delete the other remote.
The name origin is just a name that we have picked as the default name for the default remote. We could have called it joe, but someone decided that origin was a better name. If you pull a remote repo it will automatically be stored as origin as this is the default name. You could rename it, if you for some reason wanted (I wouldnt recommend it)
i recommend taking a git tutorial, having git knowledge is pretty much mandatory these days
as for your question
Imagine you want to upload to code to Google Drive because you fear that your computer may die and you lost your code. Or have someone download that code and review from GGDrive
Thats it, now you have 2 code folders: one one your own machine (called local) and one on the GGDrive (called remote)
only we use github, gitlab,... instead of gg drive