William Seiti Mizuta
@williammizuta
Caelum | Ensino e Inovação
www.caelum.com.br


On Tue, Apr 30, 2013 at 9:05 AM, <ro.naldfi.sc...@gmail.com> wrote:

> I am learning git using a tutorial, and stumbled over the following
> problem:
>
> Starting with my own repository, I had created a bare repository, and
> assigned a name to it, like this:
>
> # I already have a repository my_repo1
> cd ~/my_repo1
>
> git clone --bare . ~/github/master.git
> git remote add master ~/github/master.git
>
> Now I created another repository:
>
> cd ~/my_repo2
> git clone ~/github/master.git .
>
>
> I can now work with the my repositories by pushing and pulling the files.
> Everything fine so far. However I noticed the following:
>
> This works:
>
> cd ~/my_repo1
> git pull ~/github/master.git
>
> But this does not:
>
> git pull master
>
> The error message I receive is: "You asked to pull from the remote
> 'master', but did not specify a branch."
>

Git says that you need to specify which branch you want to send to the
master remote. The default branch name is master, which will be a little
confusing. You will need to use the command git pull master master, where
the first master is the remote repository and the second is the branch that
you want to send.

To avoid telling which branch you want to send, you can track an existing
local branch to an existing remote branch. For this, use git branch
--set-upstream-to=master/master master if you use git 1.7 or git branch -u
master/master master if you use git 1.8.

With this, a simple git pull master will resolve your problem.



>
> I thought that my assigning the name "master" to the remote repository, I
> can just use this name instead of the long "real" name, but obviously this
> is not true. It seems that the command "git remote add" not 'just' adds an
> alternative name to the repository, but has some additional semantics.
>
> Could someone please enlighten be here?
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Git for human beings" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to git-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to