threads / discuss / 18431

git-push on packed refs via HTTP

Subject: git-push on packed refs via HTTP

## tl;dr

9 messages between Mar 20, 2009 and Mar 27, 2009.

replies: 8people: 5as markdown or json

Steve· Mar 20, 2009, 09:50 UTC · lore
Hi

Using HTTP as transport, I've noticed that after using git-gc on a git server, I can't push to that repo anymore: "No refs in common and none specified." Client and server are both 1.6.2. Is ths a bug or do I have to do something after executing git-gc on the server?

Thanks! Steve
Thomas Jarosch· Mar 20, 2009, 10:03 UTC · re: Steve · lore

Re: git-push on packed refs via HTTP

Hi Steve,
On Friday, 20. March 2009 10:50:57 you wrote:
> Using HTTP as transport, I've noticed that after using git-gc on a git
> server, I can't push to that repo anymore: "No refs in common and none
> specified." Client and server are both 1.6.2. Is ths a bug or do I have to
> do something after executing git-gc on the server?

Check the permissions of the files on the server, I once accidentally executed git commands as root user and the HTTP server was later unable to read/write the repository properly.

Thomas
Steve· Mar 20, 2009, 10:25 UTC · re: Thomas Jarosch · lore

Re: git-push on packed refs via HTTP

Thomas Jarosch <thomas.jarosch <at> intra2net.com> writes:
> Check the permissions of the files on the server, I once accidentally executed
> git commands as root user and the HTTP server was later
> unable to read/write the repository properly.
The perms are okay, yet the error message remains.
Andreas Ericsson· Mar 20, 2009, 10:38 UTC · re: Steve · lore

Re: git-push on packed refs via HTTP

Steve wrote:
Show 7 quoted lines
> Hi
> 
> Using HTTP as transport, I've noticed that after using git-gc on a git server, I
> can't push to that repo anymore: "No refs in common and none specified." Client
> and server are both 1.6.2. Is ths a bug or do I have to do something after
> executing git-gc on the server?
> 

I had this happen once after having upgraded git on the server in question and then running "git gc" against a repo. I didn't remove the old (not packed-refs knowing) git though, and when I later tried to push to it, it couldn't find any refs since the old receive-pack was being used, and it didn't know about packed refs.

Worth checking, possibly.
-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
Steve· Mar 20, 2009, 10:50 UTC · re: Andreas Ericsson · lore

Re: git-push on packed refs via HTTP

Show 5 quoted lines
> I had this happen once after having upgraded git on the server in question and
> then running "git gc" against a repo. I didn't remove the old (not packed-refs
> knowing) git though, and when I later tried to push to it, it couldn't find
> any refs since the old receive-pack was being used, and it didn't know about
> packed refs.

Which file/contents do I have to look for or remove in order to kick the old not packed refs?

Tay Ray Chuan· Mar 20, 2009, 12:00 UTC · re: Steve · lore

Re: git-push on packed refs via HTTP

Hi,
On Fri, Mar 20, 2009 at 5:50 PM, Steve <shrotty@gmx.ch> wrote:
> Using HTTP as transport, I've noticed that after using git-gc on a git server, I
> can't push to that repo anymore: "No refs in common and none specified." Client
> and server are both 1.6.2. Is ths a bug or do I have to do something after
> executing git-gc on the server?
could you try running git update-server-info?
-- 
Cheers,
Ray Chuan
Johannes Schindelin· Mar 20, 2009, 12:45 UTC · re: Steve · lore

Re: git-push on packed refs via HTTP

Hi,
On Fri, 20 Mar 2009, Steve wrote:
> > could you try running git update-server-info?
> 
> Forgot to mention that: I have tried git update-server-info, yet no 
> luck.

Actually, you have to undo the ref-packing performed by gc. You can do it this way (quick and dirty):

	$ git show-ref |
	  while read sha1 name
	  do
		mkdir -p .git/$(dirname $name) &&
		echo $sha1 > .git/$name
	  done

Hth, Dscho

Steve· Mar 27, 2009, 10:20 UTC · re: Johannes Schindelin · lore

Re: git-push on packed refs via HTTP

Hi Dscho

Thanks for your snippet, that did the trick. I only had to alter it slightly because the repo on the server is bare:

git show-ref |
while read sha1 name
do
  mkdir -p $(dirname $name) &&
  echo $sha1 > $name
done

Just for understanding: Why is this step necessary? Does it have anything to do with serving the repo over HTTP at all?

Cheers, Steve

← back to recent threads