{"thread":{"id":"21179","subject":"can't create a branch on remote","startedAt":"2009-10-09T21:35:03Z","lastAt":"2009-10-12T07:19:20Z","messageCount":4,"participants":["Auguste Mome","Björn Steinbrink","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"124531","messageId":"17cb70ee0910091435l4c4d1736hf4d403a2fe6331a2@mail.gmail.com","threadId":"21179","inReplyTo":null,"subject":"can't create a branch on remote","fromName":"Auguste Mome","fromEmail":"augustmome@gmail.com","sentAt":"2009-10-09T21:35:03Z","receivedAt":"2009-10-09T21:35:03Z","isPatch":false,"sender":{"key":"augustmome@gmail.com","avatar":null},"body":"Hi,\nI have two repositories  /home/user/linux and /home/user/dev/linux,\nsame user on same machine.\nHere is how I create a local branch at v2.6.21.7 in /home/user/dev/linux,\n#pwd\n/home/user/dev/linux\n# git remote add l2621\ngit://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.21.y.git\n# git fetch l2621\n# git branch mylocal26217  v2.6.21.7\n\nNow I would like to do the same from the other repository /home/user/linux:\n# pwd\n/home/user/linux\n# git remote add other /home/guerin/dev/git/linux-2.6\n# git fetch other\n# git push /home/user/dev/git/linux-2.6\n    v2.6.21.7:refs/heads/new_feature_name26217\nTotal 0 (delta 0), reused 0 (delta 0)\nerror: Trying to write non-commit object\n170684ef0557d4b711a86595d31dcbebcb9d4ba2 to branch\nrefs/heads/new_feature_name26217\nTo /home/user/dev/git/linux-2.6\n ! [remote rejected] v2.6.21.7 -> new_feature_name26217 (failed to write)\nerror: failed to push some refs to '/home/user/dev/git/linux-2.6'\n\nMaybe something to configure to authorize the creation of branch?\n\nThanks,\nAuguste.\n"},{"id":"124535","messageId":"20091009215436.GA21017@atjola.homenet","threadId":"21179","inReplyTo":"17cb70ee0910091435l4c4d1736hf4d403a2fe6331a2@mail.gmail.com","subject":"Re: can't create a branch on remote","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-10-09T21:54:36Z","receivedAt":"2009-10-09T21:54:36Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2009.10.09 23:35:03 +0200, Auguste Mome wrote:\n> # git branch mylocal26217  v2.6.21.7\n\nThis automatically peels the v2.6.21.7 tag to get the commit object, and\ncreates the new branch head, referencing that commit.\n\n> # git push /home/user/dev/git/linux-2.6\n>     v2.6.21.7:refs/heads/new_feature_name26217\n> Total 0 (delta 0), reused 0 (delta 0)\n> error: Trying to write non-commit object\n> 170684ef0557d4b711a86595d31dcbebcb9d4ba2 to branch\n> refs/heads/new_feature_name26217\n\nThis didn't peel the tag, because you might actually want the remote ref\nto reference the tag, not the commit referenced by the tag. So you tried\nto create a branch head that would reference a tag, and that is not\nallowed. To peel the tag you can use:\nv2.6.21.7^0\nv2.6.21.7^{commit}\nv2.6.21.7^{}\n\nThe first two ensure that you actually get a commit object or an error,\nthe last one just peels the tag until it finds a non-tag object.\n\nSo:\ngit push /home/user/dev/git/linux-2.6 \\\n\tv2.6.21.7^0:refs/heads/new_feature_name26217\n\nshould do the trick.\n\nThough I don't see why you would create a branch like that. Usually, I'd\nexpect you to create new_feature_name26217 locally, work on it, and then\njust push that branch head, instead of creating that rather pointless\nbranch head remotely.\n\nBjörn\n"},{"id":"124536","messageId":"m363aogqz9.fsf@localhost.localdomain","threadId":"21179","inReplyTo":"17cb70ee0910091435l4c4d1736hf4d403a2fe6331a2@mail.gmail.com","subject":"Re: can't create a branch on remote","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-10-09T22:08:42Z","receivedAt":"2009-10-09T22:08:42Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Auguste Mome <augustmome@gmail.com> writes:\n\n> Hi,\n> I have two repositories  /home/user/linux and /home/user/dev/linux,\n> same user on same machine.\n> Here is how I create a local branch at v2.6.21.7 in /home/user/dev/linux,\n> #pwd\n> /home/user/dev/linux\n> # git remote add l2621\n> git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.21.y.git\n> # git fetch l2621\n> # git branch mylocal26217  v2.6.21.7\n> \n> Now I would like to do the same from the other repository /home/user/linux:\n> # pwd\n> /home/user/linux\n> # git remote add other /home/guerin/dev/git/linux-2.6\n> # git fetch other\n> # git push /home/user/dev/git/linux-2.6\n>     v2.6.21.7:refs/heads/new_feature_name26217\n> Total 0 (delta 0), reused 0 (delta 0)\n> error: Trying to write non-commit object\n\n  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n> 170684ef0557d4b711a86595d31dcbebcb9d4ba2 to branch\n> refs/heads/new_feature_name26217\n> To /home/user/dev/git/linux-2.6\n>  ! [remote rejected] v2.6.21.7 -> new_feature_name26217 (failed to write)\n> error: failed to push some refs to '/home/user/dev/git/linux-2.6'\n> \n> Maybe something to configure to authorize the creation of branch?\n\nYou can't push tag to branch.  \n\n\nI'm not sure if what you are trying to do makes sense at all, but the\ncommit pointed by v2.6.21.7 is v2.6.21.7^{}\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"124676","messageId":"17cb70ee0910120019pb9ba3fxaf2a47957d36d09e@mail.gmail.com","threadId":"21179","inReplyTo":"m363aogqz9.fsf@localhost.localdomain","subject":"Re: can't create a branch on remote","fromName":"Auguste Mome","fromEmail":"augustmome@gmail.com","sentAt":"2009-10-12T07:19:20Z","receivedAt":"2009-10-12T07:19:20Z","isPatch":false,"sender":{"key":"augustmome@gmail.com","avatar":null},"body":"OK thanks I'm going to try this out, let me ask a question because it\nsounds my work flow is not good.\nI don't want to push the work done in my local branch to head/master,\nI want to push this work into\n\"long-live\" branch of a central repository, which belongs to \"admin\",\nand eventually this branch does not exist yet.\nmy-central-repo: master, origin = linux-2.6.git\n                        branch1, branched at v2.6.21.7\n                        branch2, branched at v2.6.21.7\n-> I want (not admin) people to clone my-repo and work on branch1\nand/or branch2.\n-> I want some people to add a new branch3 at v2.6.21.7 into my-central-repo.\n    (This will not happen very often, can be restricted to admin)\n\nMaybe in this case it is common to define more \"public\" repositories:\n repo-branch1/ and repo-branch2/\nI guess people could then clone repo-branchX and push the work done,\nand up to owner of my-central-repo\nto merge repo-branchX/master into my-central-repo/branchX?\n\nAuguste.\n\n\n\n2009/10/10 Jakub Narebski <jnareb@gmail.com>:\n> Auguste Mome <augustmome@gmail.com> writes:\n>\n>> Hi,\n>> I have two repositories  /home/user/linux and /home/user/dev/linux,\n>> same user on same machine.\n>> Here is how I create a local branch at v2.6.21.7 in /home/user/dev/linux,\n>> #pwd\n>> /home/user/dev/linux\n>> # git remote add l2621\n>> git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.21.y.git\n>> # git fetch l2621\n>> # git branch mylocal26217  v2.6.21.7\n>>\n>> Now I would like to do the same from the other repository /home/user/linux:\n>> # pwd\n>> /home/user/linux\n>> # git remote add other /home/guerin/dev/git/linux-2.6\n>> # git fetch other\n>> # git push /home/user/dev/git/linux-2.6\n>>     v2.6.21.7:refs/heads/new_feature_name26217\n>> Total 0 (delta 0), reused 0 (delta 0)\n>> error: Trying to write non-commit object\n>\n>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n>\n>> 170684ef0557d4b711a86595d31dcbebcb9d4ba2 to branch\n>> refs/heads/new_feature_name26217\n>> To /home/user/dev/git/linux-2.6\n>>  ! [remote rejected] v2.6.21.7 -> new_feature_name26217 (failed to write)\n>> error: failed to push some refs to '/home/user/dev/git/linux-2.6'\n>>\n>> Maybe something to configure to authorize the creation of branch?\n>\n> You can't push tag to branch.\n>\n>\n> I'm not sure if what you are trying to do makes sense at all, but the\n> commit pointed by v2.6.21.7 is v2.6.21.7^{}\n>\n> --\n> Jakub Narebski\n> Poland\n> ShadeHawk on #git\n>\n"}]}