Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is origin mapped to, how to find out

Tags:

Say you

git remote add origin [email protected]:myRepo.git 

And then .. you know .. you forget what exactly origin is mapped to :(

How can you find out?

like image 338
James Raitsev Avatar asked Jun 19 '12 01:06

James Raitsev


People also ask

How do you check what origin is?

You can view that origin with the command git remote -v, which will list the URL of the remote repo.

What is origin in git origin?

In Git, "origin" is a shorthand name for the remote repository that a project was originally cloned from. More precisely, it is used instead of that original repository's URL - and thereby makes referencing much easier. Note that origin is by no means a "magical" name, but just a standard convention.

Is Origin remote or local?

Simply put: origin is just a name (the default name) for a remote (just meaning not your local) git repository.


1 Answers

git remote -v 

will list them. The source for this information can be seen by inspecting .git/config:

cat .git/config 

The config file in the .git directory at the base of your repository contains all the configuration in a plain-text format.

You'll see something like this:

[remote "origin"]         url = [email protected]:myRepo.git         fetch = +refs/heads/*:refs/remotes/origin/* 

The url line (in git config parlance, the value of remote.origin.url) contains the remote URL.

The other way to find out is by executing git config remote.origin.url:

$ git config remote.origin.url [email protected]:myRepo.git $  
like image 145
Asherah Avatar answered Oct 02 '22 02:10

Asherah