git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* can't create a branch on remote
@ 2009-10-09 21:35 Auguste Mome
  2009-10-09 21:54 ` Björn Steinbrink
  2009-10-09 22:08 ` Jakub Narebski
  0 siblings, 2 replies; 4+ messages in thread
From: Auguste Mome @ 2009-10-09 21:35 UTC (permalink / raw)
  To: git

Hi,
I have two repositories  /home/user/linux and /home/user/dev/linux,
same user on same machine.
Here is how I create a local branch at v2.6.21.7 in /home/user/dev/linux,
#pwd
/home/user/dev/linux
# git remote add l2621
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.21.y.git
# git fetch l2621
# git branch mylocal26217  v2.6.21.7

Now I would like to do the same from the other repository /home/user/linux:
# pwd
/home/user/linux
# git remote add other /home/guerin/dev/git/linux-2.6
# git fetch other
# git push /home/user/dev/git/linux-2.6
    v2.6.21.7:refs/heads/new_feature_name26217
Total 0 (delta 0), reused 0 (delta 0)
error: Trying to write non-commit object
170684ef0557d4b711a86595d31dcbebcb9d4ba2 to branch
refs/heads/new_feature_name26217
To /home/user/dev/git/linux-2.6
 ! [remote rejected] v2.6.21.7 -> new_feature_name26217 (failed to write)
error: failed to push some refs to '/home/user/dev/git/linux-2.6'

Maybe something to configure to authorize the creation of branch?

Thanks,
Auguste.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: can't create a branch on remote
  2009-10-09 21:35 can't create a branch on remote Auguste Mome
@ 2009-10-09 21:54 ` Björn Steinbrink
  2009-10-09 22:08 ` Jakub Narebski
  1 sibling, 0 replies; 4+ messages in thread
From: Björn Steinbrink @ 2009-10-09 21:54 UTC (permalink / raw)
  To: Auguste Mome; +Cc: git

On 2009.10.09 23:35:03 +0200, Auguste Mome wrote:
> # git branch mylocal26217  v2.6.21.7

This automatically peels the v2.6.21.7 tag to get the commit object, and
creates the new branch head, referencing that commit.

> # git push /home/user/dev/git/linux-2.6
>     v2.6.21.7:refs/heads/new_feature_name26217
> Total 0 (delta 0), reused 0 (delta 0)
> error: Trying to write non-commit object
> 170684ef0557d4b711a86595d31dcbebcb9d4ba2 to branch
> refs/heads/new_feature_name26217

This didn't peel the tag, because you might actually want the remote ref
to reference the tag, not the commit referenced by the tag. So you tried
to create a branch head that would reference a tag, and that is not
allowed. To peel the tag you can use:
v2.6.21.7^0
v2.6.21.7^{commit}
v2.6.21.7^{}

The first two ensure that you actually get a commit object or an error,
the last one just peels the tag until it finds a non-tag object.

So:
git push /home/user/dev/git/linux-2.6 \
	v2.6.21.7^0:refs/heads/new_feature_name26217

should do the trick.

Though I don't see why you would create a branch like that. Usually, I'd
expect you to create new_feature_name26217 locally, work on it, and then
just push that branch head, instead of creating that rather pointless
branch head remotely.

Björn

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: can't create a branch on remote
  2009-10-09 21:35 can't create a branch on remote Auguste Mome
  2009-10-09 21:54 ` Björn Steinbrink
@ 2009-10-09 22:08 ` Jakub Narebski
  2009-10-12  7:19   ` Auguste Mome
  1 sibling, 1 reply; 4+ messages in thread
From: Jakub Narebski @ 2009-10-09 22:08 UTC (permalink / raw)
  To: Auguste Mome; +Cc: git

Auguste Mome <augustmome@gmail.com> writes:

> Hi,
> I have two repositories  /home/user/linux and /home/user/dev/linux,
> same user on same machine.
> Here is how I create a local branch at v2.6.21.7 in /home/user/dev/linux,
> #pwd
> /home/user/dev/linux
> # git remote add l2621
> git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.21.y.git
> # git fetch l2621
> # git branch mylocal26217  v2.6.21.7
> 
> Now I would like to do the same from the other repository /home/user/linux:
> # pwd
> /home/user/linux
> # git remote add other /home/guerin/dev/git/linux-2.6
> # git fetch other
> # git push /home/user/dev/git/linux-2.6
>     v2.6.21.7:refs/heads/new_feature_name26217
> Total 0 (delta 0), reused 0 (delta 0)
> error: Trying to write non-commit object

  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> 170684ef0557d4b711a86595d31dcbebcb9d4ba2 to branch
> refs/heads/new_feature_name26217
> To /home/user/dev/git/linux-2.6
>  ! [remote rejected] v2.6.21.7 -> new_feature_name26217 (failed to write)
> error: failed to push some refs to '/home/user/dev/git/linux-2.6'
> 
> Maybe something to configure to authorize the creation of branch?

You can't push tag to branch.  


I'm not sure if what you are trying to do makes sense at all, but the
commit pointed by v2.6.21.7 is v2.6.21.7^{}

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: can't create a branch on remote
  2009-10-09 22:08 ` Jakub Narebski
@ 2009-10-12  7:19   ` Auguste Mome
  0 siblings, 0 replies; 4+ messages in thread
From: Auguste Mome @ 2009-10-12  7:19 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

OK thanks I'm going to try this out, let me ask a question because it
sounds my work flow is not good.
I don't want to push the work done in my local branch to head/master,
I want to push this work into
"long-live" branch of a central repository, which belongs to "admin",
and eventually this branch does not exist yet.
my-central-repo: master, origin = linux-2.6.git
                        branch1, branched at v2.6.21.7
                        branch2, branched at v2.6.21.7
-> I want (not admin) people to clone my-repo and work on branch1
and/or branch2.
-> I want some people to add a new branch3 at v2.6.21.7 into my-central-repo.
    (This will not happen very often, can be restricted to admin)

Maybe in this case it is common to define more "public" repositories:
 repo-branch1/ and repo-branch2/
I guess people could then clone repo-branchX and push the work done,
and up to owner of my-central-repo
to merge repo-branchX/master into my-central-repo/branchX?

Auguste.



2009/10/10 Jakub Narebski <jnareb@gmail.com>:
> Auguste Mome <augustmome@gmail.com> writes:
>
>> Hi,
>> I have two repositories  /home/user/linux and /home/user/dev/linux,
>> same user on same machine.
>> Here is how I create a local branch at v2.6.21.7 in /home/user/dev/linux,
>> #pwd
>> /home/user/dev/linux
>> # git remote add l2621
>> git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.21.y.git
>> # git fetch l2621
>> # git branch mylocal26217  v2.6.21.7
>>
>> Now I would like to do the same from the other repository /home/user/linux:
>> # pwd
>> /home/user/linux
>> # git remote add other /home/guerin/dev/git/linux-2.6
>> # git fetch other
>> # git push /home/user/dev/git/linux-2.6
>>     v2.6.21.7:refs/heads/new_feature_name26217
>> Total 0 (delta 0), reused 0 (delta 0)
>> error: Trying to write non-commit object
>
>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>> 170684ef0557d4b711a86595d31dcbebcb9d4ba2 to branch
>> refs/heads/new_feature_name26217
>> To /home/user/dev/git/linux-2.6
>>  ! [remote rejected] v2.6.21.7 -> new_feature_name26217 (failed to write)
>> error: failed to push some refs to '/home/user/dev/git/linux-2.6'
>>
>> Maybe something to configure to authorize the creation of branch?
>
> You can't push tag to branch.
>
>
> I'm not sure if what you are trying to do makes sense at all, but the
> commit pointed by v2.6.21.7 is v2.6.21.7^{}
>
> --
> Jakub Narebski
> Poland
> ShadeHawk on #git
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-10-12  7:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-09 21:35 can't create a branch on remote Auguste Mome
2009-10-09 21:54 ` Björn Steinbrink
2009-10-09 22:08 ` Jakub Narebski
2009-10-12  7:19   ` Auguste Mome

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).