git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to make "git push/pull" work in non-clone repo?
@ 2011-11-03 14:59 Hong-Ming Su
  2011-11-03 15:07 ` Frans Klaver
  2011-11-03 16:09 ` Kirill Likhodedov
  0 siblings, 2 replies; 6+ messages in thread
From: Hong-Ming Su @ 2011-11-03 14:59 UTC (permalink / raw)
  To: git

Hi,

I create a repo X with git init. After several commit in X, I clone a
bare repo Y from X.
I try to continue work in X, and push to/pull from Y. The command git
push and git pull fails. I see the error message but I do not know
which git command can fix that problem.
Then I clone Z from Y. git push/pull works in Z.
How to make "git push/pull" the same in X as in Z?

Thanks,
Hong-Ming

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to make "git push/pull" work in non-clone repo?
  2011-11-03 14:59 How to make "git push/pull" work in non-clone repo? Hong-Ming Su
@ 2011-11-03 15:07 ` Frans Klaver
  2011-11-03 16:09 ` Kirill Likhodedov
  1 sibling, 0 replies; 6+ messages in thread
From: Frans Klaver @ 2011-11-03 15:07 UTC (permalink / raw)
  To: Hong-Ming Su; +Cc: git

Hi,

On Thu, Nov 3, 2011 at 3:59 PM, Hong-Ming Su <halleyinvent@gmail.com> wrote:

> I create a repo X with git init. After several commit in X, I clone a
> bare repo Y from X.
> I try to continue work in X, and push to/pull from Y. The command git
> push and git pull fails. I see the error message but I do not know
> which git command can fix that problem.

Care to tell us which commands you use and which errors you get? It
will give clues about how to help.


> Then I clone Z from Y. git push/pull works in Z.
> How to make "git push/pull" the same in X as in Z?

Same here.

Cheers,
Frans

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to make "git push/pull" work in non-clone repo?
  2011-11-03 14:59 How to make "git push/pull" work in non-clone repo? Hong-Ming Su
  2011-11-03 15:07 ` Frans Klaver
@ 2011-11-03 16:09 ` Kirill Likhodedov
  2011-11-03 16:10   ` Hong-Ming Su
  1 sibling, 1 reply; 6+ messages in thread
From: Kirill Likhodedov @ 2011-11-03 16:09 UTC (permalink / raw)
  To: Hong-Ming Su; +Cc: git



03.11.2011, в 17:59, Hong-Ming Su:

> I create a repo X with git init. After several commit in X, I clone a
> bare repo Y from X.
> I try to continue work in X, and push to/pull from Y. The command git
> push and git pull fails. I see the error message but I do not know
> which git command can fix that problem.
> Then I clone Z from Y. git push/pull works in Z.
> How to make "git push/pull" the same in X as in Z?
> 


By cloning Y from X you made X to be a parent of Y while you need vice versa.
To fix this add Y as a remote to X and set up tracking for you master branch.

By the way, in such cases you'd better write commands you've executed, and the error report you've got.
" I see the error message but I do not know which git command can fix that problem" - this is zero of useful information.

----------------------------------
Kirill Likhodedov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to make "git push/pull" work in non-clone repo?
  2011-11-03 16:09 ` Kirill Likhodedov
@ 2011-11-03 16:10   ` Hong-Ming Su
  2011-11-03 17:00     ` Andreas Schwab
  0 siblings, 1 reply; 6+ messages in thread
From: Hong-Ming Su @ 2011-11-03 16:10 UTC (permalink / raw)
  To: Kirill Likhodedov; +Cc: git

Thank for your hints. I get "git push" work. The "git pull" need argument.

/d/workspace/git
$ ls
depot  work1  work2

/d/workspace/git
$ git clone --bare work1 depot
Cloning into bare repository depot...
done.

/d/workspace/git/work1 (master)
$ git push
fatal: No destination configured to push to.

/d/workspace/git/work1 (master)
$ git pull
fatal: No remote repository specified.  Please, specify either a URL or a
remote name from which new revisions should be fetched.

/d/workspace/git/work1 (master)
$ git remote add origin ../depot

/d/workspace/git/work1 (master)
$ git push
Everything up-to-date

/d/workspace/git/work1 (master)
$ git pull
From ../depot
 * [new branch]      master     -> origin/master
You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.

If you often merge with the same branch, you may want to
use something like the following in your configuration file:

    [branch "master"]
    remote = <nickname>
    merge = <remote-ref>

    [remote "<nickname>"]
    url = <url>
    fetch = <refspec>

/d/workspace/git/work1 (master)
$ git pull origin master:master
Already up-to-date.
2011/11/4 Kirill Likhodedov <Kirill.Likhodedov@jetbrains.com>:
>
>
> 03.11.2011, в 17:59, Hong-Ming Su:
>
>> I create a repo X with git init. After several commit in X, I clone a
>> bare repo Y from X.
>> I try to continue work in X, and push to/pull from Y. The command git
>> push and git pull fails. I see the error message but I do not know
>> which git command can fix that problem.
>> Then I clone Z from Y. git push/pull works in Z.
>> How to make "git push/pull" the same in X as in Z?
>>
>
>
> By cloning Y from X you made X to be a parent of Y while you need vice versa.
> To fix this add Y as a remote to X and set up tracking for you master branch.
>
> By the way, in such cases you'd better write commands you've executed, and the error report you've got.
> " I see the error message but I do not know which git command can fix that problem" - this is zero of useful information.
>
> ----------------------------------
> Kirill Likhodedov
> JetBrains, Inc
> http://www.jetbrains.com
> "Develop with pleasure!"
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to make "git push/pull" work in non-clone repo?
  2011-11-03 16:10   ` Hong-Ming Su
@ 2011-11-03 17:00     ` Andreas Schwab
  2011-11-04  3:33       ` Hong-Ming Su
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2011-11-03 17:00 UTC (permalink / raw)
  To: Hong-Ming Su; +Cc: Kirill Likhodedov, git

Hong-Ming Su <halleyinvent@gmail.com> writes:

> /d/workspace/git/work1 (master)
> $ git remote add origin ../depot

$ git branch --set-upstream master origin/master

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to make "git push/pull" work in non-clone repo?
  2011-11-03 17:00     ` Andreas Schwab
@ 2011-11-04  3:33       ` Hong-Ming Su
  0 siblings, 0 replies; 6+ messages in thread
From: Hong-Ming Su @ 2011-11-04  3:33 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Kirill Likhodedov, git

git push -u can set upstream too.
Thanks all!

On Fri, Nov 4, 2011 at 1:00 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Hong-Ming Su <halleyinvent@gmail.com> writes:
>
>> /d/workspace/git/work1 (master)
>> $ git remote add origin ../depot
>
> $ git branch --set-upstream master origin/master
>
> Andreas.
>
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-11-04  3:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-03 14:59 How to make "git push/pull" work in non-clone repo? Hong-Ming Su
2011-11-03 15:07 ` Frans Klaver
2011-11-03 16:09 ` Kirill Likhodedov
2011-11-03 16:10   ` Hong-Ming Su
2011-11-03 17:00     ` Andreas Schwab
2011-11-04  3:33       ` Hong-Ming Su

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).