Re: problem pushing repository

13 messages, 7 authors, 2016-06-15 · open the first message on its own page

Re: problem pushing repository

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:17

"Adam Mercer" [off-list ref] writes:
[ram@skymoo glue]$ git push
ssh://ram@newberry.ihepa.ufl.edu/~ram/public_html/git/glue.git
bash: line 1: git-receive-pack: command not found
fatal: The remote end hung up unexpectedly
error: failed to push to
'ssh://ram@newberry.ihepa.ufl.edu/~ram/public_html/git/glue.git'
[ram@skymoo glue]$ which git-receive-pack
/Users/ram/opt/git/bin/git-receive-pack
[ram@skymoo glue]$

git-receive-pack is in my $PATH so why can't it be found when trying to push?
Check your ssh and ssh server settings.  Often the process
invoked from non-interactive ssh connection (such as the attempt
to invoke receive-pack) would not get the PATH you set up in ~/.login
or ~/.bash_profile.

	$ ssh newberry.ihepa.ufl.edu sh -c 'echo $PATH'

may be a good starting point to test this, and the first step
to fix it would be

	$ man ssh
	$ man sshd

Re: problem pushing repository

From: Andrew Ruder <hidden>
Date: 2016-06-15 22:43:17

On Thu, Jun 21, 2007 at 07:00:18PM -0700, Junio C Hamano wrote:
	$ ssh newberry.ihepa.ufl.edu sh -c 'echo $PATH'

may be a good starting point to test this, and the first step
to fix it would be

	$ man ssh
	$ man sshd
While I wholeheartedly agree with Junio here, you may also find

remote.<name>.receivepack

useful, see git-push(1) and git-config(1) for more information.

- Andy

-- 
Andrew Ruder [off-list ref]
http://www.aeruder.net

Re: problem pushing repository

From: Raimund Bauer <hidden>
Date: 2016-06-15 22:43:17

On Thu, 2007-06-21 at 21:24 -0500, Andrew Ruder wrote:
On Thu, Jun 21, 2007 at 07:00:18PM -0700, Junio C Hamano wrote:
quoted
	$ ssh newberry.ihepa.ufl.edu sh -c 'echo $PATH'

may be a good starting point to test this, and the first step
to fix it would be

	$ man ssh
	$ man sshd
While I wholeheartedly agree with Junio here, you may also find

remote.<name>.receivepack
Yes, but it doesn't always work.
I have a server with several repositories, and git is installed
in /usr/local/bin.
All my local repostories know this server as a remote named 'slcom' and
I have a 2 global options
remote.slcom.uploadpack=/usr/local/bin/git-upload-pack
remote.slcom.receivepack=/usr/local/bin/git-receive-pack

Fetching, pulling and normal pushing works.
Pushing a new branch to the remote doesn't work:
$ git branch test
$ git push slcom test:test 
error: dst refspec test does not match any existing ref on the remote
and does not start with refs/.
fatal: The remote end hung up unexpectedly
error: failed to push to
'ray@softwarelandschaft.com:/home/ray/repos/drupal/multirate'

git-remote also has a problem:
$ git remote show slcom
bash: git-upload-pack: command not found
fatal: The remote end hung up unexpectedly
ls-remote --heads
ray@softwarelandschaft.com:/home/ray/repos/drupal/multirate: command
returned error: 1

All this with git from yesterday (next).
- Andy
-- 
best regards

  Ray

Re: problem pushing repository

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:43:17

Hi,

On Fri, 22 Jun 2007, Raimund Bauer wrote:
$ git push slcom test:test 
error: dst refspec test does not match any existing ref on the remote
and does not start with refs/.
fatal: The remote end hung up unexpectedly
error: failed to push to
'ray@softwarelandschaft.com:/home/ray/repos/drupal/multirate'
This is a completely unrelated problem!

It says that there is no branch named "test" on the remote side, and since 
you could also want to push a tag, you have to say

	test:refs/heads/test

here. However, I do not understand why you bother to use the :dst syntax 
here, since your target name is _exactly_ the same as the source name. Why 
not just

	git push slcom test

Hm??
git-remote also has a problem:
$ git remote show slcom
bash: git-upload-pack: command not found
fatal: The remote end hung up unexpectedly
ls-remote --heads
ray@softwarelandschaft.com:/home/ray/repos/drupal/multirate: command
returned error: 1
That's apparently a bug in git-remote.

Ciao,
Dscho

Re: problem pushing repository

From: Adam Mercer <hidden>
Date: 2016-06-15 22:43:17

On 21/06/07, Junio C Hamano [off-list ref] wrote:
"Adam Mercer" [off-list ref] writes:
quoted
[ram@skymoo glue]$ git push
ssh://ram@newberry.ihepa.ufl.edu/~ram/public_html/git/glue.git
bash: line 1: git-receive-pack: command not found
fatal: The remote end hung up unexpectedly
error: failed to push to
'ssh://ram@newberry.ihepa.ufl.edu/~ram/public_html/git/glue.git'
[ram@skymoo glue]$ which git-receive-pack
/Users/ram/opt/git/bin/git-receive-pack
[ram@skymoo glue]$

git-receive-pack is in my $PATH so why can't it be found when trying to push?
Check your ssh and ssh server settings.  Often the process
invoked from non-interactive ssh connection (such as the attempt
to invoke receive-pack) would not get the PATH you set up in ~/.login
or ~/.bash_profile.

        $ ssh newberry.ihepa.ufl.edu sh -c 'echo $PATH'

may be a good starting point to test this, and the first step
to fix it would be

        $ man ssh
        $ man sshd
Thanks Junio thats the problem my path isn't being set correctly on newberry

[ram@skymoo ram]$ ssh newberry sh -c 'echo $PATH'

[ram@skymoo ram]$ ssh newberry
[ram@newberry ram]$ which git-receive-pack
~/opt/git/bin/git-receive-pack
[ram@newberry ram]$

Cheers

Adam

Re: problem pushing repository

From: Adam Mercer <hidden>
Date: 2016-06-15 22:43:17

On 21/06/07, Andrew Ruder [off-list ref] wrote:
On Thu, Jun 21, 2007 at 07:00:18PM -0700, Junio C Hamano wrote:
quoted
      $ ssh newberry.ihepa.ufl.edu sh -c 'echo $PATH'

may be a good starting point to test this, and the first step
to fix it would be

      $ man ssh
      $ man sshd
While I wholeheartedly agree with Junio here, you may also find

remote.<name>.receivepack

useful, see git-push(1) and git-config(1) for more information.
This seems like the best way to fix this issue, however it isn't clear
from the man page what I need to put in my ~/.gitconfig. With the
following in .gitconfig

[remote]
glue.receivepack = /home/ram/opt/git/bin/git-receive-pack

I get the following error when trying to push

[ram@skymoo glue]$ git push
ssh://newberry.ihepa.ufl.edu/~/public_html/git/glue.git
fatal: bad config file line 6 in /Users/ram/.gitconfig

so this is clearly not the right entry. Can someone please give me a
push in the right direction?

Cheers

Adam

Re: problem pushing repository

From: Raimund Bauer <hidden>
Date: 2016-06-15 22:43:17

Hi,

On Fri, 2007-06-22 at 12:26 +0100, Johannes Schindelin wrote: 
Hi,

On Fri, 22 Jun 2007, Raimund Bauer wrote:
quoted
$ git push slcom test:test 
error: dst refspec test does not match any existing ref on the remote
and does not start with refs/.
fatal: The remote end hung up unexpectedly
error: failed to push to
'ray@softwarelandschaft.com:/home/ray/repos/drupal/multirate'
This is a completely unrelated problem!

It says that there is no branch named "test" on the remote side, and since 
you could also want to push a tag, you have to say

	test:refs/heads/test

here. However, I do not understand why you bother to use the :dst syntax 
here, since your target name is _exactly_ the same as the source name. Why 
not just

	git push slcom test
because I had gotten the command line from bash-completion and since it
worked with existing branches I saw no reason why it shouldn't work with
new ones.
will read the documentation next time ;-)
Ciao,
Dscho
-- 
best regards

  Ray

Re: problem pushing repository

From: Raimund Bauer <hidden>
Date: 2016-06-15 22:43:17

On Fri, 2007-06-22 at 09:36 -0400, Adam Mercer wrote:
This seems like the best way to fix this issue, however it isn't clear
quoted
from the man page what I need to put in my ~/.gitconfig. With the
following in .gitconfig

[remote]
glue.receivepack = /home/ram/opt/git/bin/git-receive-pack
In my config it looks like this:

[remote "slcom"]
        uploadpack = /usr/local/bin/git-upload-pack
        receivepack = /usr/local/bin/git-receive-pack

-- 
best regards

  Ray

Re: problem pushing repository

From: Adam Mercer <hidden>
Date: 2016-06-15 22:43:17

On 22/06/07, Raimund Bauer [off-list ref] wrote:
In my config it looks like this:

[remote "slcom"]
        uploadpack = /usr/local/bin/git-upload-pack
        receivepack = /usr/local/bin/git-receive-pack
putting

[remote "glue"]
  uploadpack = /home/ram/opt/git/bin/git-upload-pack
  receivepack = /home/ram/opt/git/bin/git-receive-pack

in my .gitconfig I still get the error saying that git-receive-pack
can't be found. If I specify the path on the git push command line
using the --exec option then git-receive-pack is found, so it appears
that my config file isn't being read.

Cheers

Adam

Re: problem pushing repository

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:43:17

Raimund Bauer [off-list ref] wrote:
On Fri, 2007-06-22 at 12:26 +0100, Johannes Schindelin wrote: 
quoted
On Fri, 22 Jun 2007, Raimund Bauer wrote:
quoted
$ git push slcom test:test 
error: dst refspec test does not match any existing ref on the remote
and does not start with refs/.
It says that there is no branch named "test" on the remote side, and since 
you could also want to push a tag, you have to say

	test:refs/heads/test

here. However, I do not understand why you bother to use the :dst syntax 
here, since your target name is _exactly_ the same as the source name. Why 
not just

	git push slcom test
because I had gotten the command line from bash-completion
I just patched the bash completion package to offer `git push slcom
test` as the completion, instead of `git push slcom test:test`.
The patch was pretty trivial, and is now also in my fastimport.git
tree on repo.or.cz.

-->8--
Avoid src:dst syntax as default bash completion for git push

Raimund Bauer just discovered that the default bash completion for
a local branch name in a git-push line is not the best choice when
the branch does not exist on the remote system.

In the past we have always completed the local name 'test' as
"test:test", indicating that the destination name is the same as
the local name.  But this fails when "test" does not yet exist on
the remote system, as there is no "test" branch for it to match
the name against.

Fortunately git-push does the right thing when given just the
local branch, as it assumes you want to use the same name in the
destination repository.  So we now offer "test" as the completion
in a git-push line, and let git-push assume that is also the remote
branch name.

We also still support the remote branch completion after the :,
but only if the user manually adds the colon before trying to get
a completion.

Signed-off-by: Shawn O. Pearce <redacted>
---
 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9e72f0f..c7c9963 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -683,7 +683,7 @@ _git_push ()
 			__gitcomp "$(__git_refs "$remote")" "" "${cur#*:}"
 			;;
 		*)
-			__gitcomp "$(__git_refs2)"
+			__gitcomp "$(__git_refs)"
 			;;
 		esac
 		;;
-- 
1.5.2.2.1050.g51a8b

-- 
Shawn.

Re: problem pushing repository

From: Raimund Bauer <hidden>
Date: 2016-06-15 22:43:17

Hi,

On Fri, 2007-06-22 at 18:47 -0400, Shawn O. Pearce wrote:
Signed-off-by: Shawn O. Pearce <redacted>
---
 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Thanks a lot, your patch makes my life easier.
Since you obviously know what you're doing here, maybe I can wish for
something too?

It would be really cool if completion also worked when I started the
branchname with a '+' to force the push ...

-- 
best regards

  Ray

Re: problem pushing repository

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:43:18

Raimund Bauer [off-list ref] wrote:
On Fri, 2007-06-22 at 18:47 -0400, Shawn O. Pearce wrote:
quoted
Signed-off-by: Shawn O. Pearce <redacted>
---
 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Thanks a lot, your patch makes my life easier.
Since you obviously know what you're doing here, maybe I can wish for
something too?
Heh, sure.  I wrote that "stock" bash completion package, but at
this point I largely consider it to be "complete and stable" and
therefore don't put a lot of effort into it anymore.

This recent thread has been interesting, as it has uncovered two
bugs related to the git-push completion.
 
It would be really cool if completion also worked when I started the
branchname with a '+' to force the push ...
How does this work?  ;-)

I'm pushing it out to my fastimport tree shortly.

-->8--
Teach bash how to complete +refspec on git-push

Using `git push origin +foo` to forcefully overwrite the remote
branch named foo is a common idiom, especially since + is shorter
than the long option --force and can be specified on a per-branch
basis.

We now complete `git push origin +foo` just like we do the standard
`git push origin foo`.  The leading + on a branch refspec does not
alter the completion.

Signed-off-by: Shawn O. Pearce <redacted>
---
 contrib/completion/git-completion.bash |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index c7c9963..f2b10fa 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -682,6 +682,9 @@ _git_push ()
 			esac
 			__gitcomp "$(__git_refs "$remote")" "" "${cur#*:}"
 			;;
+		+*)
+			__gitcomp "$(__git_refs)" + "${cur#+}"
+			;;
 		*)
 			__gitcomp "$(__git_refs)"
 			;;
-- 
1.5.2.2.1334.g1625


-- 
Shawn.

Re: problem pushing repository

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:43:18

Shawn O. Pearce wrote:
Heh, sure.  I wrote that "stock" bash completion package, but at
this point I largely consider it to be "complete and stable" and
therefore don't put a lot of effort into it anymore.
One thing that annoys me greatly (and I think I use newest completion)
is that sometimes _filename_ completion gets confused on the '.' separating
basename and extension, and instead of completing extension it adds another
dot to make range operator '..' and triec to complete branch name, even if
basename is _not_ any branch name.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help