James Raitsev
James Raitsev

Reputation: 96391

What is origin mapped to, how to find out

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?

Upvotes: 30

Views: 24796

Answers (3)

Andrew Marshall
Andrew Marshall

Reputation: 96934

git remote -v

will give a list of all remote along with their corresponding URLs. You can find out even more information about the remote by doing

git remote show origin

Read more in the man page for git-remote.

Upvotes: 9

Felix Kling
Felix Kling

Reputation: 816384

You can run the following command:

git remote -v

to get a list of all remotes with their URL.

From the man-page:

OPTIONS
-v, --verbose
Be a little more verbose and show remote url after name. NOTE: This must be placed between remote and subcommand.

COMMANDS
With no arguments, shows a list of existing remotes. Several subcommands are available to perform operations on the remotes.

Upvotes: 6

Asherah
Asherah

Reputation: 19347

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
$ 

Upvotes: 48

Related Questions