threads / discuss / 13741

unable to push

Subject: unable to push

## tl;dr

11 messages between May 31, 2008 and Jun 1, 2008.

replies: 10people: 3as markdown or json

david@lang.hm· May 31, 2008, 15:03 UTC · lore

for some reason when I try to push to my public repo I get a message that everything is up to date, but if I switch to that repo and do a pull it updates properly

I tried recreating the public repo the last time this happened, but it looks like when I do git am followed by git revert --hard HEAD^ (to fix the patch) followed by git am it breaks again.

David Lang
root@asgard:/var/www/adastra/xml2pdf/current# git push public
root@asgard's password:
Everything up-to-date
root@asgard:/var/www/adastra/xml2pdf/current# git ls-remote public
root@asgard's password:
d3f3d8474db1c006a53be8b5f5c1a0d866d7e357        HEAD
d3f3d8474db1c006a53be8b5f5c1a0d866d7e357        refs/heads/localmaster
d3f3d8474db1c006a53be8b5f5c1a0d866d7e357        refs/remotes/origin/master
7fcb26098cb3885f8b553b052ca3c3dfef3a508b        refs/tags/1.5.1
73580be6e04cf2e106c70ab352a94e2bfd5faeb6        refs/tags/1.5.10
85fe03cb12f795c2b40239d0e656de63eb7c81d7        refs/tags/1.5.11
469a1473911289b9a60c069094113bb9ef97a0f8        refs/tags/1.5.12
94bc2757622ccfd3668dd9b505d623893e37efbe        refs/tags/1.6.0
5aef76575a993d51f0ae628b36964c37cd26a7c3        refs/tags/1.7.0
0141ecaa92a34aac63fb2c0689683eb1a701dca3        refs/tags/1.7.1
d5d7d1962bdb8d5f7444696cb4ea07d6a6ab8d9e        refs/tags/1.7.2
2a844908229621f9c31ccb5b33d8907abeb64b36        refs/tags/1.7.4
8c07c4666d6e9eb88f0197416a38f841cf2c9b9d        refs/tags/1.7.6
046968a4fa5767db9387e940d5138ac10391020f        refs/tags/1.8.0
ec48db4ecacda648333596ef17ce8a0a588645a8        refs/tags/1.8.1
ad7c88741bf2631eca9c3d24721b1bd8ec4a4793        refs/tags/1.8.2
be0f3ccd11f5064b40f089b62152b820fb3aaf6f        refs/tags/1.8.3
root@asgard:/var/www/adastra/xml2pdf/current# git ls-remote .
71ab4eea48eb3407a2ff4eef2befe9251897d676        HEAD
71ab4eea48eb3407a2ff4eef2befe9251897d676        refs/heads/master
7fcb26098cb3885f8b553b052ca3c3dfef3a508b        refs/tags/1.5.1
73580be6e04cf2e106c70ab352a94e2bfd5faeb6        refs/tags/1.5.10
85fe03cb12f795c2b40239d0e656de63eb7c81d7        refs/tags/1.5.11
469a1473911289b9a60c069094113bb9ef97a0f8        refs/tags/1.5.12
94bc2757622ccfd3668dd9b505d623893e37efbe        refs/tags/1.6.0
5aef76575a993d51f0ae628b36964c37cd26a7c3        refs/tags/1.7.0
0141ecaa92a34aac63fb2c0689683eb1a701dca3        refs/tags/1.7.1
d5d7d1962bdb8d5f7444696cb4ea07d6a6ab8d9e        refs/tags/1.7.2
2a844908229621f9c31ccb5b33d8907abeb64b36        refs/tags/1.7.4
8c07c4666d6e9eb88f0197416a38f841cf2c9b9d        refs/tags/1.7.6
046968a4fa5767db9387e940d5138ac10391020f        refs/tags/1.8.0
ec48db4ecacda648333596ef17ce8a0a588645a8        refs/tags/1.8.1
ad7c88741bf2631eca9c3d24721b1bd8ec4a4793        refs/tags/1.8.2
be0f3ccd11f5064b40f089b62152b820fb3aaf6f        refs/tags/1.8.3
a633ac7b02b513e0d8a44152448e3c43ace996d0        refs/tags/1.8.4
71ab4eea48eb3407a2ff4eef2befe9251897d676        refs/tags/1.8.5
root@asgard:/var/www/adastra/xml2pdf/current# cd /var/www/git/xml2pdf.git/
root@asgard:/var/www/git/xml2pdf.git# git pull
remote: Counting objects: 8, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 6 (delta 4), reused 0 (delta 0)
Unpacking objects: 100% (6/6), done.
From /movies/www/adastra/xml2pdf/current/
    d3f3d84..71ab4ee  master     -> origin/master
  * [new tag]         1.8.5      -> 1.8.5
Updating d3f3d84..71ab4ee
Fast forward
  xml2pdf.pl |   22 +++++++++++-----------
  1 files changed, 11 insertions(+), 11 deletions(-)
root@asgard:/var/www/git/xml2pdf.git# cd -
/var/www/adastra/xml2pdf/current
root@asgard:/var/www/adastra/xml2pdf/current# git ls-remote public
root@asgard's password:
71ab4eea48eb3407a2ff4eef2befe9251897d676        HEAD
71ab4eea48eb3407a2ff4eef2befe9251897d676        refs/heads/localmaster
71ab4eea48eb3407a2ff4eef2befe9251897d676        refs/remotes/origin/master
7fcb26098cb3885f8b553b052ca3c3dfef3a508b        refs/tags/1.5.1
73580be6e04cf2e106c70ab352a94e2bfd5faeb6        refs/tags/1.5.10
85fe03cb12f795c2b40239d0e656de63eb7c81d7        refs/tags/1.5.11
469a1473911289b9a60c069094113bb9ef97a0f8        refs/tags/1.5.12
94bc2757622ccfd3668dd9b505d623893e37efbe        refs/tags/1.6.0
5aef76575a993d51f0ae628b36964c37cd26a7c3        refs/tags/1.7.0
0141ecaa92a34aac63fb2c0689683eb1a701dca3        refs/tags/1.7.1
d5d7d1962bdb8d5f7444696cb4ea07d6a6ab8d9e        refs/tags/1.7.2
2a844908229621f9c31ccb5b33d8907abeb64b36        refs/tags/1.7.4
8c07c4666d6e9eb88f0197416a38f841cf2c9b9d        refs/tags/1.7.6
046968a4fa5767db9387e940d5138ac10391020f        refs/tags/1.8.0
ec48db4ecacda648333596ef17ce8a0a588645a8        refs/tags/1.8.1
ad7c88741bf2631eca9c3d24721b1bd8ec4a4793        refs/tags/1.8.2
be0f3ccd11f5064b40f089b62152b820fb3aaf6f        refs/tags/1.8.3
71ab4eea48eb3407a2ff4eef2befe9251897d676        refs/tags/1.8.5
root@asgard:/var/www/adastra/xml2pdf/current# git ls-remote .
71ab4eea48eb3407a2ff4eef2befe9251897d676        HEAD
71ab4eea48eb3407a2ff4eef2befe9251897d676        refs/heads/master
7fcb26098cb3885f8b553b052ca3c3dfef3a508b        refs/tags/1.5.1
73580be6e04cf2e106c70ab352a94e2bfd5faeb6        refs/tags/1.5.10
85fe03cb12f795c2b40239d0e656de63eb7c81d7        refs/tags/1.5.11
469a1473911289b9a60c069094113bb9ef97a0f8        refs/tags/1.5.12
94bc2757622ccfd3668dd9b505d623893e37efbe        refs/tags/1.6.0
5aef76575a993d51f0ae628b36964c37cd26a7c3        refs/tags/1.7.0
0141ecaa92a34aac63fb2c0689683eb1a701dca3        refs/tags/1.7.1
d5d7d1962bdb8d5f7444696cb4ea07d6a6ab8d9e        refs/tags/1.7.2
2a844908229621f9c31ccb5b33d8907abeb64b36        refs/tags/1.7.4
8c07c4666d6e9eb88f0197416a38f841cf2c9b9d        refs/tags/1.7.6
046968a4fa5767db9387e940d5138ac10391020f        refs/tags/1.8.0
ec48db4ecacda648333596ef17ce8a0a588645a8        refs/tags/1.8.1
ad7c88741bf2631eca9c3d24721b1bd8ec4a4793        refs/tags/1.8.2
be0f3ccd11f5064b40f089b62152b820fb3aaf6f        refs/tags/1.8.3
a633ac7b02b513e0d8a44152448e3c43ace996d0        refs/tags/1.8.4
71ab4eea48eb3407a2ff4eef2befe9251897d676        refs/tags/1.8.5
Jeff King· May 31, 2008, 15:50 UTC · re: david@lang.hm · lore

Re: unable to push

On Sat, May 31, 2008 at 08:03:47AM -0700, david@lang.hm wrote:
> for some reason when I try to push to my public repo I get a message that  
> everything is up to date, but if I switch to that repo and do a pull it  
> updates properly

If you "git push" without a refspec, it pushes "matching branches". See git-push(1) for more details.

> root@asgard:/var/www/adastra/xml2pdf/current# git ls-remote public
> d3f3d8474db1c006a53be8b5f5c1a0d866d7e357        HEAD
> d3f3d8474db1c006a53be8b5f5c1a0d866d7e357        refs/heads/localmaster
So you have only one branch, "localmaster".
> root@asgard:/var/www/adastra/xml2pdf/current# git ls-remote .
> 71ab4eea48eb3407a2ff4eef2befe9251897d676        HEAD
> 71ab4eea48eb3407a2ff4eef2befe9251897d676        refs/heads/master
But the remote has only one branch, "master".
If you want to push your localmaster to his master, you can do:
  git push origin localmaster:master

You can also set it up permanently by adding a "remote.origin.push" line to your config file.

But I do wonder why you don't just name your local branch "master" in the first place (it won't conflict in your local repo with the remote's master, which can be named as "origin/master").

Show 12 quoted lines
> root@asgard:/var/www/git/xml2pdf.git# git pull
> remote: Counting objects: 8, done.
> remote: Compressing objects: 100% (6/6), done.
> remote: Total 6 (delta 4), reused 0 (delta 0)
> Unpacking objects: 100% (6/6), done.
> From /movies/www/adastra/xml2pdf/current/
>    d3f3d84..71ab4ee  master     -> origin/master
>  * [new tag]         1.8.5      -> 1.8.5
> Updating d3f3d84..71ab4ee
> Fast forward
>  xml2pdf.pl |   22 +++++++++++-----------
>  1 files changed, 11 insertions(+), 11 deletions(-)

And this pulls from master -> localmaster, presumably because you have a branch.localmaster.merge config option (which is generally set up by default these days).

-Peff
david@lang.hm· May 31, 2008, 16:10 UTC · re: Jeff King · lore

Re: unable to push

On Sat, 31 May 2008, Jeff King wrote:
Show 31 quoted lines
> On Sat, May 31, 2008 at 08:03:47AM -0700, david@lang.hm wrote:
>
>> for some reason when I try to push to my public repo I get a message that
>> everything is up to date, but if I switch to that repo and do a pull it
>> updates properly
>
> If you "git push" without a refspec, it pushes "matching branches". See
> git-push(1) for more details.
>
>> root@asgard:/var/www/adastra/xml2pdf/current# git ls-remote public
>> d3f3d8474db1c006a53be8b5f5c1a0d866d7e357        HEAD
>> d3f3d8474db1c006a53be8b5f5c1a0d866d7e357        refs/heads/localmaster
>
> So you have only one branch, "localmaster".
>
>> root@asgard:/var/www/adastra/xml2pdf/current# git ls-remote .
>> 71ab4eea48eb3407a2ff4eef2befe9251897d676        HEAD
>> 71ab4eea48eb3407a2ff4eef2befe9251897d676        refs/heads/master
>
> But the remote has only one branch, "master".
>
> If you want to push your localmaster to his master, you can do:
>
>  git push origin localmaster:master
>
> You can also set it up permanently by adding a "remote.origin.push" line
> to your config file.
>
> But I do wonder why you don't just name your local branch "master" in
> the first place (it won't conflict in your local repo with the remote's
> master, which can be named as "origin/master").

I created localmaster in an attempt to get things working again. I'll try creating a new master branch... that does make it work again, thanks.

what I'm not understanding completely is how I broke things in the first place.

going back through .git/logs/HEAD it looks like I did a checkout HEAD^^^ and never properly recovered. should I have done a checkout master to get things back on track? I had thought that I could do a checkout of an old version, modify it, do a commit, and the commit would go on top of the old HEAD and I could just keep going (the reason for doing this instead of a reset is that I had already published the intermediate commits to the public repo, so I didn't want to roll back the history, just get the old version of one of the files)

Show 16 quoted lines
>> root@asgard:/var/www/git/xml2pdf.git# git pull
>> remote: Counting objects: 8, done.
>> remote: Compressing objects: 100% (6/6), done.
>> remote: Total 6 (delta 4), reused 0 (delta 0)
>> Unpacking objects: 100% (6/6), done.
>> From /movies/www/adastra/xml2pdf/current/
>>    d3f3d84..71ab4ee  master     -> origin/master
>>  * [new tag]         1.8.5      -> 1.8.5
>> Updating d3f3d84..71ab4ee
>> Fast forward
>>  xml2pdf.pl |   22 +++++++++++-----------
>>  1 files changed, 11 insertions(+), 11 deletions(-)
>
> And this pulls from master -> localmaster, presumably because you have a
> branch.localmaster.merge config option (which is generally set up by
> default these days).

I manually setup the localmaster when I was having trouble getting things to work in either direction.

David Lang
Jeff King· Jun 1, 2008, 18:22 UTC · re: david@lang.hm · lore

Re: unable to push

On Sat, May 31, 2008 at 09:10:26AM -0700, david@lang.hm wrote:
Show 5 quoted lines
> I created localmaster in an attempt to get things working again. I'll try  
> creating a new master branch... that does make it work again, thanks.
>
> what I'm not understanding completely is how I broke things in the first  
> place.

I'm not understanding that, either. You not only created localmaster, but you deleted master. Did you maybe do a "git branch -m"?

Show 8 quoted lines
> going back through .git/logs/HEAD it looks like I did a checkout HEAD^^^  
> and never properly recovered. should I have done a checkout master to get  
> things back on track? I had thought that I could do a checkout of an old  
> version, modify it, do a commit, and the commit would go on top of the old 
> HEAD and I could just keep going (the reason for doing this instead of a  
> reset is that I had already published the intermediate commits to the  
> public repo, so I didn't want to roll back the history, just get the old  
> version of one of the files)

I think you did eventually "recover" which is to say you ended up on the localmaster branch. When you did a checkout of HEAD^^^, your HEAD became "detached", meaning that you were no longer on any branch, but at a specific commit (and there should have been a warning message mentioning that).

When you make commits on a detached HEAD, your HEAD remains detached, meaning that those commits are not on any branch. So when you did a checkout back to some actual branch, those commits were "lost" (meaning that no branch contains them, but they are still available by peeking through the reflog).

But that shouldn't have had anything to do with the state of the master branch; once you detached, you were purely operating on the detached HEAD.

-Peff
Jeff King· Jun 1, 2008, 18:25 UTC · re: Jeff King · lore

Re: unable to push

On Sun, Jun 01, 2008 at 02:22:05PM -0400, Jeff King wrote:
> I'm not understanding that, either. You not only created localmaster,
> but you deleted master. Did you maybe do a "git branch -m"?

Having just read Adam's message, I see that I read your "ls-remote"s backwards.

So it's not that you created localmaster and deleted master, but rather that somehow the master on your "public" repo got deleted (or never existed in the first place?).

-Peff
david@lang.hm· Jun 1, 2008, 18:28 UTC · re: Jeff King · lore

Re: unable to push

On Sun, 1 Jun 2008, Jeff King wrote:
Show 10 quoted lines
> On Sat, May 31, 2008 at 09:10:26AM -0700, david@lang.hm wrote:
>
>> I created localmaster in an attempt to get things working again. I'll try
>> creating a new master branch... that does make it work again, thanks.
>>
>> what I'm not understanding completely is how I broke things in the first
>> place.
>
> I'm not understanding that, either. You not only created localmaster,
> but you deleted master. Did you maybe do a "git branch -m"?

in the public repo I had never created a 'master' branch. I had just done a clone, setup git daemon, and pushed to it.

at some point several days later I found that my push didn't work and that I wasn't on any branch in the public repo. in reading the man page for git branch I saw the --track option, so I created the localmaster branch to try and get things working.

Show 24 quoted lines
>> going back through .git/logs/HEAD it looks like I did a checkout HEAD^^^
>> and never properly recovered. should I have done a checkout master to get
>> things back on track? I had thought that I could do a checkout of an old
>> version, modify it, do a commit, and the commit would go on top of the old
>> HEAD and I could just keep going (the reason for doing this instead of a
>> reset is that I had already published the intermediate commits to the
>> public repo, so I didn't want to roll back the history, just get the old
>> version of one of the files)
>
> I think you did eventually "recover" which is to say you ended up on the
> localmaster branch. When you did a checkout of HEAD^^^, your HEAD became
> "detached", meaning that you were no longer on any branch, but at a
> specific commit (and there should have been a warning message mentioning
> that).
>
> When you make commits on a detached HEAD, your HEAD remains detached,
> meaning that those commits are not on any branch. So when you did a
> checkout back to some actual branch, those commits were "lost" (meaning
> that no branch contains them, but they are still available by peeking
> through the reflog).
>
> But that shouldn't have had anything to do with the state of the master
> branch; once you detached, you were purely operating on the detached
> HEAD.
that explains things.
David Lang
Jeff King· Jun 1, 2008, 18:31 UTC · re: david@lang.hm · lore

Re: unable to push

On Sun, Jun 01, 2008 at 11:28:39AM -0700, david@lang.hm wrote:
Show 5 quoted lines
>> I'm not understanding that, either. You not only created localmaster,
>> but you deleted master. Did you maybe do a "git branch -m"?
>
> in the public repo I had never created a 'master' branch. I had just done  
> a clone, setup git daemon, and pushed to it.

Did you mean "init" here instead of clone? The clone should have created at least one branch (generally master, but depending on the current branch of the cloned repo).

> at some point several days later I found that my push didn't work and that 
> I wasn't on any branch in the public repo. in reading the man page for git 
> branch I saw the --track option, so I created the localmaster branch to  
> try and get things working.

Ah, ok. That makes sense. The right fix was to just manually specify the refspec the first time ("git push public master") after which you could just do "git push public" if you wanted.

-Peff
david@lang.hm· Jun 1, 2008, 18:34 UTC · re: Jeff King · lore

Re: unable to push

On Sun, 1 Jun 2008, Jeff King wrote:
Show 11 quoted lines
> On Sun, Jun 01, 2008 at 11:28:39AM -0700, david@lang.hm wrote:
>
>>> I'm not understanding that, either. You not only created localmaster,
>>> but you deleted master. Did you maybe do a "git branch -m"?
>>
>> in the public repo I had never created a 'master' branch. I had just done
>> a clone, setup git daemon, and pushed to it.
>
> Did you mean "init" here instead of clone? The clone should have created
> at least one branch (generally master, but depending on the current
> branch of the cloned repo).

no, it was definantly a clone, and it did not create a master branch (at least not one that showed up with git branch -a)

David Lang
Show 11 quoted lines
>> at some point several days later I found that my push didn't work and that
>> I wasn't on any branch in the public repo. in reading the man page for git
>> branch I saw the --track option, so I created the localmaster branch to
>> try and get things working.
>
> Ah, ok. That makes sense. The right fix was to just manually specify the
> refspec the first time ("git push public master") after which you could
> just do "git push public" if you wanted.
>
> -Peff
>
Jeff King· Jun 1, 2008, 18:36 UTC · re: david@lang.hm · lore

Re: unable to push

On Sun, Jun 01, 2008 at 11:34:19AM -0700, david@lang.hm wrote:
Show 6 quoted lines
>> Did you mean "init" here instead of clone? The clone should have created
>> at least one branch (generally master, but depending on the current
>> branch of the cloned repo).
>
> no, it was definantly a clone, and it did not create a master branch (at  
> least not one that showed up with git branch -a)

Hmm. It's possible that you cloned a repo that didn't have its HEAD pointing at the master branch (for example, one with a detached HEAD). And that would explain how you got into that situation (and either way, the discussed ways out of the situation apply).

-Peff
Adam Piątyszek· May 31, 2008, 16:52 UTC · re: Jeff King · lore

Re: unable to push

* Jeff King [31 V 2008 17:50]:
Show 24 quoted lines
> On Sat, May 31, 2008 at 08:03:47AM -0700, david@lang.hm wrote:
> 
>> for some reason when I try to push to my public repo I get a message that  
>> everything is up to date, but if I switch to that repo and do a pull it  
>> updates properly
> 
> If you "git push" without a refspec, it pushes "matching branches". See
> git-push(1) for more details.
> 
>> root@asgard:/var/www/adastra/xml2pdf/current# git ls-remote public
>> d3f3d8474db1c006a53be8b5f5c1a0d866d7e357        HEAD
>> d3f3d8474db1c006a53be8b5f5c1a0d866d7e357        refs/heads/localmaster
> 
> So you have only one branch, "localmaster".
> 
>> root@asgard:/var/www/adastra/xml2pdf/current# git ls-remote .
>> 71ab4eea48eb3407a2ff4eef2befe9251897d676        HEAD
>> 71ab4eea48eb3407a2ff4eef2befe9251897d676        refs/heads/master
> 
> But the remote has only one branch, "master".
> 
> If you want to push your localmaster to his master, you can do:
> 
>   git push origin localmaster:master
[...]

I guess Peef described it the opposite way. In my opinion "localmaster" is the only branch on the remote "public" repository and the local repository has only one "master" branch.

So to push local "master" to the remote "localmaster" branch you should use:
   git push public master:localmaster

BR, /Adam

-- 
.:.  Adam Piątyszek (ediap)  .:.....................................:.
.:.  ediap@users.sourceforge.net  .:................................:.
Jeff King· Jun 1, 2008, 18:24 UTC · re: Adam Piątyszek · lore

Re: unable to push

On Sat, May 31, 2008 at 06:52:18PM +0200, Adam Piątyszek wrote:
Show 20 quoted lines
>>> root@asgard:/var/www/adastra/xml2pdf/current# git ls-remote public
>>> d3f3d8474db1c006a53be8b5f5c1a0d866d7e357        HEAD
>>> d3f3d8474db1c006a53be8b5f5c1a0d866d7e357        refs/heads/localmaster
>>
>> So you have only one branch, "localmaster".
>>
>>> root@asgard:/var/www/adastra/xml2pdf/current# git ls-remote .
>>> 71ab4eea48eb3407a2ff4eef2befe9251897d676        HEAD
>>> 71ab4eea48eb3407a2ff4eef2befe9251897d676        refs/heads/master
>>
>> But the remote has only one branch, "master".
>>
>> If you want to push your localmaster to his master, you can do:
>>
>>   git push origin localmaster:master
> [...]
>
> I guess Peef described it the opposite way. In my opinion "localmaster"  
> is the only branch on the remote "public" repository and the local  
> repository has only one "master" branch.

Oh, sorry, I did totally read that backwards. So yes, there is a local "master" branch but not a remote master branch (instead it has "localmaster"). So the problem is the same (push without a refspec pushes matching refs, and you don't have any matches) but the fix is, as Adam pointed out:

> So to push local "master" to the remote "localmaster" branch you should use:
>
>   git push public master:localmaster
Sorry for the confusion.
-Peff

← back to recent threads