Re: [git-users] Re: Find Git repository mapping

2013-01-15 Thread John McKown
Konstantin gave you a good answer. But I'll put in one from my newbie self.

When you create a new repo, and you use a "git clone" command. That
automatically sets up a remote called "origin" with a URL which is
where you cloned from. E.g.

I did:

git clone https://github.com/git/git

and in the git subdirectory, I did a

git remote -v

which resulted in:

origin  https://github.com/git/git (fetch)
origin  https://github.com/git/git (push)

This was set up for me automagically by the "git clone" command.

Hope this helps some.

On Tue, Jan 15, 2013 at 6:56 AM, Floriano Fauzzi
 wrote:
> Hi Thomas,
> thanks for the answer. I'm sorry, I didnt explain my question clearly. I try
> to clarify it by this scenario:
> "Paul has a repository on GitHub called rep1 with some files. On his pc,
> Paul clones it into the local repo called rep2 and stored, say, in C:\ "
>
> Now the question is:
> How does git know that the local repo stored in "C:\rep2" is mapped on the
> remote rep1 (so that, when I push any local change I've commited, they are
> sent to the right origin)?
> Is this piece of info stored in a file? I mean, the remote -v command you
> wrote about, how does it retrieves the info it then displays?
>
> Hope this is clearer now.
> Thanks a lot in advance for your time and help.
> Regards,
> Floriano
>
> Il giorno martedì 15 gennaio 2013 13:20:31 UTC+1, Thomas Ferris Nicolaisen
> ha scritto:
>>
>> On Tuesday, January 15, 2013 12:37:25 PM UTC+1, Floriano Fauzzi wrote:
>>>
>>> Hi,
>>> I want to know what is the file where, Git portable or Git stand alone
>>> software, store the mapping between the clone repository ( on pc ) and the
>>> web repository.
>>> I need this information because I know that clone repository could have a
>>> different name compared to web repository.
>>> Thanks for the answers.
>>
>>
>> A git repository has zero or more remotes. These are other git
>> repositories that contain more or less the same contents as you have
>> locally.
>>
>> To see which remotes you currently have configured, use:
>>
>> git remote -v
>>
>> To see more details about a given remote, for example one called "origin"
>> (which is the default name for the remote when you create the local repo by
>> cloning it from the remote one), do:
>>
>> git remote show origin
>
> --
>
>



-- 
Maranatha! <><
John McKown

-- 




Re: [git-users] Re: Find Git repository mapping

2013-01-15 Thread Konstantin Khomoutov
On Tue, 15 Jan 2013 04:56:31 -0800 (PST)
Floriano Fauzzi  wrote:

> >> I want to know what is the file where, Git portable or Git stand
> >> alone software, store the mapping between the clone repository
> >> ( on pc ) and the web repository.
> >> I need this information because I know that clone repository could
> >> have a different name compared to web repository.
> >> Thanks for the answers.
> >
> > A git repository has zero or more remotes. These are other git 
> > repositories that contain more or less the same contents as you
> > have locally.
> >
> > To see which remotes you currently have configured, use:
> >
> > git remote -v
> >
> > To see more details about a given remote, for example one called
> > "origin" (which is the default name for the remote when you create
> > the local repo by cloning it from the remote one), do:
> >
> > git remote show origin
> 
> thanks for the answer. I'm sorry, I didnt explain my question
> clearly. I try to clarify it by this scenario:
> "Paul has a repository on GitHub called *rep1 *with some files. On
> his pc, Paul clones it into the local repo called *rep2 *and stored,
> say, in C:\ "
> 
> Now the question is:
> How does git know that the local repo stored in "C:\rep2" is mapped
> on the remote rep1 (so that, when I push any local change I've
> commited, they are sent to the right origin)?

Strictly speaking, Git does not know that.  In theory, you are able to
push any line of history from any local repository to any remote
repository you have push access to.  And you're able to fetch anything
into your local repository from any remote repo you have pull access to.
As should be clear now, Git does not "tie" a local repository to any
remote repository.

Instead, Git has the concept of "named remotes" to help you work with
remote repositories, and the so-called "remote branches" which mirror
states of remote repositories.

> Is this piece of info stored in a file? I mean, the* remote -v
> *command you wrote about, how does it retrieves the info it then
> displays?

This information is stored in the repository-local configuration file
which is ".git/config".

--