git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Holger Hellmuth <hellmuth@ira.uka.de>
To: pbGit <pblakeley@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Problems pushing???
Date: Sun, 08 Jul 2012 23:20:25 +0200	[thread overview]
Message-ID: <4FF9F999.9030808@ira.uka.de> (raw)
In-Reply-To: <1341762216101-7562707.post@n2.nabble.com>

Am 08.07.2012 17:43, schrieb pbGit:
> Just tried starting again on my local machine because when I tried pushing,
> git said that it local was also set to bare init.  When I looked this was
> the case.  Silly me.
>
> So I deleted on my local and added a single file and when I try pushing this
> I get the following:
>   ! [rejected]        master ->  master (non-fast-forward)
> error: failed to push some refs to 'paul@localhost:/Users/paul/<prject>'
> hint: Updates were rejected because the tip of your current branch is behind
> hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
> hint: before pushing again.
> hint: See the 'Note about fast-forwards' in 'git push --help' for details.
>
> When I try and pull I then get the following:
> fatal: No remote repository specified.  Please, specify either a URL or a
> remote name from which new revisions should be fetched.
>
> I then addded my repo with the following command, but  this is the wrong
> syntax!!!
> git pull --repo=<project>
>
> What the hell am I doing wrong???

This is the moment where you have to begin reading man pages, i.e. "git 
fetch", "git help pull", "git help remote" "git help push" (read the 
examples as they show typical use cases) or preferably read about it in 
books like Pro Git (git-scm.com/book/) or tutorials.

For example the --repo parameter in "git push --repo=<project>" doesn't 
exactly do what you think it does. It only sets the default remote repo 
from "origin" to <project>. Normally you would just use "git push 
<project>". And the equivalent pull command would be "git pull <project>".

Naturally you can configure that git pull or git push will just do what 
you want, but for that you need to know what a refspec is and how to use 
"git remote".

Generally git pull and git push are not complementary. Neither in effect 
nor in parameters they take.

For example assume you have just cloned a remote repository. This will 
add configuration that connects both repositories and adds a default 
remote repo named origin and adds default refspecs

"git pull" without parameters will then fetch all remote branches into 
correpondingly named local remote tracking branches (under 
.git/refs/remotes/, do a git branch -a to list them too), but then only 
merge one of them with the branch you are in at the moment.

But "git push" will push *all* your local branches into branches of the 
same name on the remote repository.

Another difference: If you pull, the merge might fail because of merge 
conflicts and you have to manually merge conflicting files. If you push, 
this manual merge is not possible so usually only trivial merges called 
fast-forward-merges are allowed. That is what happened on your push

Something like "git remote add -m master origin <urlofyourrepo>" does 
the same configuration as a "git clone" would do and would allow you to 
just use "git pull" without parameters.

  reply	other threads:[~2012-07-08 21:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-08  9:12 Problems pushing??? pbGit
2012-07-08 11:02 ` Konstantin Khomoutov
2012-07-08 11:52 ` Holger Hellmuth
2012-07-08 12:21   ` Konstantin Khomoutov
2012-07-08 14:51   ` pbGit
2012-07-08 15:43     ` pbGit
2012-07-08 21:20       ` Holger Hellmuth [this message]
2012-07-10  6:59         ` pbGit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FF9F999.9030808@ira.uka.de \
    --to=hellmuth@ira.uka.de \
    --cc=git@vger.kernel.org \
    --cc=pblakeley@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).