threads / discuss / 5775

pushing fails - WHY?

Subject: pushing fails - WHY?

## tl;dr

3 messages between Oct 1, 2006 and Oct 2, 2006.

replies: 2people: 2as markdown or json

Alan Chandler· Oct 1, 2006, 10:38 UTC · lore

I am just coming back to repeat the setting up of my public git repositories after loosing them in a disk crash a little while ago.

The first repository I am setting up is called akclib on server roo.home
so in /var/lib/git on that machine I did

mkdir akclib.git GIT_DIR akclib.git git init-db --shared

Back on my workstation where my master repository resides
~/dev/akcmoney
I have a .git/remotes/public file which contains

URL:roo.home:/var/lib/git/akclib.git Push:master

BUT WHEN I attempt to push -  thus

alan@kanger:~/dev/akclib[master]$ git push public fatal: remote 'public' has no URL

It fails. But I don't understand why. Can someone point me at what I am doing wrong.

(git is version 1.4.2.1 on the workstation, 1.4.1 on the server)
-- 
Alan Chandler
http://www.chandlerfamily.org.uk
Alan Chandler· Oct 1, 2006, 11:53 UTC · re: Alan Chandler · lore

ANSWER

On Sunday 01 October 2006 11:38, Alan Chandler wrote:
> I have a .git/remotes/public file which contains
>
> URL:roo.home:/var/lib/git/akclib.git
> Push:master
The URL: and Push: need spaces before the detail

This used to work, so somewhere along the line (when the builtin was introduced?) the need for the space has arisen.

The documentation, although showing the space is not very clear about it.
-- 
Alan Chandler
http://www.chandlerfamily.org.uk
Junio C Hamano· Oct 2, 2006, 07:40 UTC · re: Alan Chandler · lore

Re: ANSWER

Alan Chandler <alan@chandlerfamily.org.uk> writes:
Show 11 quoted lines
> On Sunday 01 October 2006 11:38, Alan Chandler wrote:
>
>> I have a .git/remotes/public file which contains
>>
>> URL:roo.home:/var/lib/git/akclib.git
>> Push:master
>
> The URL: and Push: need spaces before the detail
>
> This used to work, so somewhere along the line (when the builtin was 
> introduced?) the need for the space has arisen.

True. I did not notice it before but this indeed is a breakage when builtin-push.c was done.

Totally untested, but it looks obvious enough...

-- >8 -- git-push: .git/remotes/ file does not require SP after colon

Although most people would have one after colon if only for readability, we never required it in git-parse-remote, so let's not require one only in git-push.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/builtin-push.c b/builtin-push.c
index c43f256..f5150ed 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -78,12 +78,12 @@ static int get_remotes_uri(const char *r
 		int is_refspec;
 		char *s, *p;
 
-		if (!strncmp("URL: ", buffer, 5)) {
+		if (!strncmp("URL:", buffer, 4)) {
 			is_refspec = 0;
-			s = buffer + 5;
-		} else if (!strncmp("Push: ", buffer, 6)) {
+			s = buffer + 4;
+		} else if (!strncmp("Push:", buffer, 5)) {
 			is_refspec = 1;
-			s = buffer + 6;
+			s = buffer + 5;
 		} else
 			continue;
 

← back to recent threads