{"thread":{"id":"20530","subject":"Unable to checkout a branch after cloning","startedAt":"2009-08-11T10:10:26Z","lastAt":"2009-08-11T14:54:48Z","messageCount":7,"participants":["Matthew Lear","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"120223","messageId":"4A814392.4080803@bubblegen.co.uk","threadId":"20530","inReplyTo":null,"subject":"Unable to checkout a branch after cloning","fromName":"Matthew Lear","fromEmail":"matt@bubblegen.co.uk","sentAt":"2009-08-11T10:10:26Z","receivedAt":"2009-08-11T10:10:26Z","isPatch":false,"sender":{"key":"matt@bubblegen.co.uk","avatar":null},"body":"Hi all,\n\nApologies for perhaps a silly question, but I'd very much appreciate a\nlittle bit of assistance.\n\nI've set up a git repository on a machine accessible from the internet\nwith the intention to share code with another developer. We clone the\nrepository, commit changes then push back as you'd expect. The server\nruns gitweb for repository browsing. Clients are running git v1.6.0.6.\n\nWhen I created the initial repository I also created two additional\nbranches - 'upstream' and 'custom'. The former is to act as a 'vendor\nbranch' and the latter contains code specific to the custom platform\nthat we're working on. The master branch contains merges from the\nupstream branch and also changes that we've made. The custom branch\ncontains merges from master with custom platform specific changes.\n\nI've committed changes and on both upstream and custom branches as work\nprogressed, merged them where appropriate, added tags etc and pushed\neverything to the remote repository. No problem. I can view the\nbranches, tags etc in gitweb and everything looks fine.\n\nHowever, I can clone a new repository just fine but I'm unable to\ncheckout the upstream or custom branches. After cloning, only the master\nbranch is available, ie:\n\n> git checkout upstream\nerror: pathspec 'upstream' did not match any file(s) known to git.\n\n> git branch -a\n* master\n  origin/HEAD\n  origin/master\n\n.git/config:\n\n[core]\n        repositoryformatversion = 0\n        filemode = true\n        bare = false\n        logallrefupdates = true\n[remote \"origin\"]\n        url = https://mysite/git/project.git\n        fetch = +refs/heads/*:refs/remotes/origin/*\n[branch \"master\"]\n        remote = origin\n        merge = refs/heads/master\n\nBut the initial local repository where I work (ie created the branches,\ncommitted changes, tag, push etc) seems to be fine, ie\n\n> git checkout upstream\nSwitched to branch \"upstream\"\n\n> git branch -a\n  custom\n* master\n  upstream\n\n.git/config:\n\n[core]\n        repositoryformatversion = 0\n        filemode = true\n        bare = false\n        logallrefupdates = true\n[remote \"origin\"]\n        url = https://mysite/git/project.git\n        fetch = +refs/heads/*:refs/remotes/origin/*\n\n\nDevelopers need to be able to clone the repository and then switch to\nthe appropriate branch in order to work. However it seems that after a\nclone, only the master branch is available.\n\nWhy is this?\n\nAny help would be much appreciated indeed.\n\nMany thanks,\n--  Matt\n"},{"id":"120228","messageId":"4A815E49.60406@drmicha.warpmail.net","threadId":"20530","inReplyTo":"4A814392.4080803@bubblegen.co.uk","subject":"Re: Unable to checkout a branch after cloning","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-08-11T12:04:25Z","receivedAt":"2009-08-11T12:04:25Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Matthew Lear venit, vidit, dixit 11.08.2009 12:10:\n> Hi all,\n> \n> Apologies for perhaps a silly question, but I'd very much appreciate a\n> little bit of assistance.\n> \n> I've set up a git repository on a machine accessible from the internet\n> with the intention to share code with another developer. We clone the\n> repository, commit changes then push back as you'd expect. The server\n> runs gitweb for repository browsing. Clients are running git v1.6.0.6.\n> \n> When I created the initial repository I also created two additional\n> branches - 'upstream' and 'custom'. The former is to act as a 'vendor\n> branch' and the latter contains code specific to the custom platform\n> that we're working on. The master branch contains merges from the\n> upstream branch and also changes that we've made. The custom branch\n> contains merges from master with custom platform specific changes.\n> \n> I've committed changes and on both upstream and custom branches as work\n> progressed, merged them where appropriate, added tags etc and pushed\n> everything to the remote repository. No problem. I can view the\n> branches, tags etc in gitweb and everything looks fine.\n> \n> However, I can clone a new repository just fine but I'm unable to\n> checkout the upstream or custom branches. After cloning, only the master\n> branch is available, ie:\n> \n>> git checkout upstream\n> error: pathspec 'upstream' did not match any file(s) known to git.\n> \n>> git branch -a\n> * master\n>   origin/HEAD\n>   origin/master\n> \n> .git/config:\n> \n> [core]\n>         repositoryformatversion = 0\n>         filemode = true\n>         bare = false\n>         logallrefupdates = true\n> [remote \"origin\"]\n>         url = https://mysite/git/project.git\n>         fetch = +refs/heads/*:refs/remotes/origin/*\n> [branch \"master\"]\n>         remote = origin\n>         merge = refs/heads/master\n> \n> But the initial local repository where I work (ie created the branches,\n> committed changes, tag, push etc) seems to be fine, ie\n> \n>> git checkout upstream\n> Switched to branch \"upstream\"\n> \n>> git branch -a\n>   custom\n> * master\n>   upstream\n> \n> .git/config:\n> \n> [core]\n>         repositoryformatversion = 0\n>         filemode = true\n>         bare = false\n>         logallrefupdates = true\n> [remote \"origin\"]\n>         url = https://mysite/git/project.git\n>         fetch = +refs/heads/*:refs/remotes/origin/*\n> \n> \n> Developers need to be able to clone the repository and then switch to\n> the appropriate branch in order to work. However it seems that after a\n> clone, only the master branch is available.\n> \n> Why is this?\n> \n> Any help would be much appreciated indeed.\n\nIf I understand you correctly you have 3 repos: the \"initial\" one on\nwhich everything is as expected, the \"server\" one and the \"new clone\"\nwhich is missing branches.\n\nNow: How's the server one doing, i.e. what does \"git ls-remote\nhttps://mysite/git/project.git\" say? I suspect that one either does not\nhave the branches (you haven't told us how you pushed) or in the wrong\nplace (remotes/).\n\nMichael\n"},{"id":"120242","messageId":"4A81613F.2080309@bubblegen.co.uk","threadId":"20530","inReplyTo":"4A815E49.60406@drmicha.warpmail.net","subject":"Re: Unable to checkout a branch after cloning","fromName":"Matthew Lear","fromEmail":"matt@bubblegen.co.uk","sentAt":"2009-08-11T12:17:03Z","receivedAt":"2009-08-11T12:17:03Z","isPatch":false,"sender":{"key":"matt@bubblegen.co.uk","avatar":null},"body":"Hi Michael - thanks for your reply.\nMichael J Gruber wrote:\n> Matthew Lear venit, vidit, dixit 11.08.2009 12:10:\n>> Hi all,\n>>\n>> Apologies for perhaps a silly question, but I'd very much appreciate a\n>> little bit of assistance.\n>>\n>> I've set up a git repository on a machine accessible from the internet\n>> with the intention to share code with another developer. We clone the\n>> repository, commit changes then push back as you'd expect. The server\n>> runs gitweb for repository browsing. Clients are running git v1.6.0.6.\n>>\n>> When I created the initial repository I also created two additional\n>> branches - 'upstream' and 'custom'. The former is to act as a 'vendor\n>> branch' and the latter contains code specific to the custom platform\n>> that we're working on. The master branch contains merges from the\n>> upstream branch and also changes that we've made. The custom branch\n>> contains merges from master with custom platform specific changes.\n>>\n>> I've committed changes and on both upstream and custom branches as work\n>> progressed, merged them where appropriate, added tags etc and pushed\n>> everything to the remote repository. No problem. I can view the\n>> branches, tags etc in gitweb and everything looks fine.\n>>\n>> However, I can clone a new repository just fine but I'm unable to\n>> checkout the upstream or custom branches. After cloning, only the master\n>> branch is available, ie:\n>>\n>>> git checkout upstream\n>> error: pathspec 'upstream' did not match any file(s) known to git.\n>>\n>>> git branch -a\n>> * master\n>>   origin/HEAD\n>>   origin/master\n>>\n>> .git/config:\n>>\n>> [core]\n>>         repositoryformatversion = 0\n>>         filemode = true\n>>         bare = false\n>>         logallrefupdates = true\n>> [remote \"origin\"]\n>>         url = https://mysite/git/project.git\n>>         fetch = +refs/heads/*:refs/remotes/origin/*\n>> [branch \"master\"]\n>>         remote = origin\n>>         merge = refs/heads/master\n>>\n>> But the initial local repository where I work (ie created the branches,\n>> committed changes, tag, push etc) seems to be fine, ie\n>>\n>>> git checkout upstream\n>> Switched to branch \"upstream\"\n>>\n>>> git branch -a\n>>   custom\n>> * master\n>>   upstream\n>>\n>> .git/config:\n>>\n>> [core]\n>>         repositoryformatversion = 0\n>>         filemode = true\n>>         bare = false\n>>         logallrefupdates = true\n>> [remote \"origin\"]\n>>         url = https://mysite/git/project.git\n>>         fetch = +refs/heads/*:refs/remotes/origin/*\n>>\n>>\n>> Developers need to be able to clone the repository and then switch to\n>> the appropriate branch in order to work. However it seems that after a\n>> clone, only the master branch is available.\n>>\n>> Why is this?\n>>\n>> Any help would be much appreciated indeed.\n> \n> If I understand you correctly you have 3 repos: the \"initial\" one on\n> which everything is as expected, the \"server\" one and the \"new clone\"\n> which is missing branches.\n\nYes, that's correct.\n\n> Now: How's the server one doing, i.e. what does \"git ls-remote\n> https://mysite/git/project.git\" say? I suspect that one either does not\n> have the branches (you haven't told us how you pushed) or in the wrong\n> place (remotes/).\n\n> git ls-remote https://mysite/git/project.git\n065f5f13d5f8e786729db1623cc53767c963e959        HEAD\n065f5f13d5f8e786729db1623cc53767c963e959        refs/heads/master\n\nHmm. So it seems that the branches are not actually on the server\nrepository. So how come I can see them with gitweb..?\n\nI've been pushing from the 'initial' repository with git push --all and\ngit push --tags.\n\nHowever, when I try a git push from the initial repository I get the\nfollowing:\n\n> git push --all\nFetching remote heads...\n  refs/\n  refs/heads/\n  refs/tags/\n'refs/heads/custom': up-to-date\n'refs/heads/master': up-to-date\n'refs/heads/upstream': up-to-date\n\n-- Matt\n"},{"id":"120266","messageId":"4A817840.9000405@drmicha.warpmail.net","threadId":"20530","inReplyTo":"4A81613F.2080309@bubblegen.co.uk","subject":"Re: Unable to checkout a branch after cloning","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-08-11T13:55:12Z","receivedAt":"2009-08-11T13:55:12Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Matthew Lear venit, vidit, dixit 11.08.2009 14:17:\n> Hi Michael - thanks for your reply.\n> Michael J Gruber wrote:\n>> Matthew Lear venit, vidit, dixit 11.08.2009 12:10:\n>>> Hi all,\n>>>\n>>> Apologies for perhaps a silly question, but I'd very much appreciate a\n>>> little bit of assistance.\n>>>\n>>> I've set up a git repository on a machine accessible from the internet\n>>> with the intention to share code with another developer. We clone the\n>>> repository, commit changes then push back as you'd expect. The server\n>>> runs gitweb for repository browsing. Clients are running git v1.6.0.6.\n>>>\n>>> When I created the initial repository I also created two additional\n>>> branches - 'upstream' and 'custom'. The former is to act as a 'vendor\n>>> branch' and the latter contains code specific to the custom platform\n>>> that we're working on. The master branch contains merges from the\n>>> upstream branch and also changes that we've made. The custom branch\n>>> contains merges from master with custom platform specific changes.\n>>>\n>>> I've committed changes and on both upstream and custom branches as work\n>>> progressed, merged them where appropriate, added tags etc and pushed\n>>> everything to the remote repository. No problem. I can view the\n>>> branches, tags etc in gitweb and everything looks fine.\n>>>\n>>> However, I can clone a new repository just fine but I'm unable to\n>>> checkout the upstream or custom branches. After cloning, only the master\n>>> branch is available, ie:\n>>>\n>>>> git checkout upstream\n>>> error: pathspec 'upstream' did not match any file(s) known to git.\n>>>\n>>>> git branch -a\n>>> * master\n>>>   origin/HEAD\n>>>   origin/master\n>>>\n>>> .git/config:\n>>>\n>>> [core]\n>>>         repositoryformatversion = 0\n>>>         filemode = true\n>>>         bare = false\n>>>         logallrefupdates = true\n>>> [remote \"origin\"]\n>>>         url = https://mysite/git/project.git\n>>>         fetch = +refs/heads/*:refs/remotes/origin/*\n>>> [branch \"master\"]\n>>>         remote = origin\n>>>         merge = refs/heads/master\n>>>\n>>> But the initial local repository where I work (ie created the branches,\n>>> committed changes, tag, push etc) seems to be fine, ie\n>>>\n>>>> git checkout upstream\n>>> Switched to branch \"upstream\"\n>>>\n>>>> git branch -a\n>>>   custom\n>>> * master\n>>>   upstream\n>>>\n>>> .git/config:\n>>>\n>>> [core]\n>>>         repositoryformatversion = 0\n>>>         filemode = true\n>>>         bare = false\n>>>         logallrefupdates = true\n>>> [remote \"origin\"]\n>>>         url = https://mysite/git/project.git\n>>>         fetch = +refs/heads/*:refs/remotes/origin/*\n>>>\n>>>\n>>> Developers need to be able to clone the repository and then switch to\n>>> the appropriate branch in order to work. However it seems that after a\n>>> clone, only the master branch is available.\n>>>\n>>> Why is this?\n>>>\n>>> Any help would be much appreciated indeed.\n>>\n>> If I understand you correctly you have 3 repos: the \"initial\" one on\n>> which everything is as expected, the \"server\" one and the \"new clone\"\n>> which is missing branches.\n> \n> Yes, that's correct.\n> \n>> Now: How's the server one doing, i.e. what does \"git ls-remote\n>> https://mysite/git/project.git\" say? I suspect that one either does not\n>> have the branches (you haven't told us how you pushed) or in the wrong\n>> place (remotes/).\n> \n>> git ls-remote https://mysite/git/project.git\n> 065f5f13d5f8e786729db1623cc53767c963e959        HEAD\n> 065f5f13d5f8e786729db1623cc53767c963e959        refs/heads/master\n> \n> Hmm. So it seems that the branches are not actually on the server\n> repository. So how come I can see them with gitweb..?\n> \n> I've been pushing from the 'initial' repository with git push --all and\n> git push --tags.\n> \n> However, when I try a git push from the initial repository I get the\n> following:\n> \n>> git push --all\n> Fetching remote heads...\n>   refs/\n>   refs/heads/\n>   refs/tags/\n> 'refs/heads/custom': up-to-date\n> 'refs/heads/master': up-to-date\n> 'refs/heads/upstream': up-to-date\n> \n> -- Matt\n\nDoes the situation improve if, on the server, you run git\nupdate-server-info? Do you have a post-update hook there?\n\nMichael\n"},{"id":"120270","messageId":"4A817F3B.7070308@bubblegen.co.uk","threadId":"20530","inReplyTo":"4A817840.9000405@drmicha.warpmail.net","subject":"Re: Unable to checkout a branch after cloning","fromName":"Matthew Lear","fromEmail":"matt@bubblegen.co.uk","sentAt":"2009-08-11T14:24:59Z","receivedAt":"2009-08-11T14:24:59Z","isPatch":false,"sender":{"key":"matt@bubblegen.co.uk","avatar":null},"body":"Michael J Gruber wrote:\n> Matthew Lear venit, vidit, dixit 11.08.2009 14:17:\n>> Hi Michael - thanks for your reply.\n>> Michael J Gruber wrote:\n>>> Matthew Lear venit, vidit, dixit 11.08.2009 12:10:\n>>>> Hi all,\n>>>>\n>>>> Apologies for perhaps a silly question, but I'd very much appreciate a\n>>>> little bit of assistance.\n>>>>\n>>>> I've set up a git repository on a machine accessible from the internet\n>>>> with the intention to share code with another developer. We clone the\n>>>> repository, commit changes then push back as you'd expect. The server\n>>>> runs gitweb for repository browsing. Clients are running git v1.6.0.6.\n>>>>\n>>>> When I created the initial repository I also created two additional\n>>>> branches - 'upstream' and 'custom'. The former is to act as a 'vendor\n>>>> branch' and the latter contains code specific to the custom platform\n>>>> that we're working on. The master branch contains merges from the\n>>>> upstream branch and also changes that we've made. The custom branch\n>>>> contains merges from master with custom platform specific changes.\n>>>>\n>>>> I've committed changes and on both upstream and custom branches as work\n>>>> progressed, merged them where appropriate, added tags etc and pushed\n>>>> everything to the remote repository. No problem. I can view the\n>>>> branches, tags etc in gitweb and everything looks fine.\n>>>>\n>>>> However, I can clone a new repository just fine but I'm unable to\n>>>> checkout the upstream or custom branches. After cloning, only the master\n>>>> branch is available, ie:\n>>>>\n>>>>> git checkout upstream\n>>>> error: pathspec 'upstream' did not match any file(s) known to git.\n>>>>\n>>>>> git branch -a\n>>>> * master\n>>>>   origin/HEAD\n>>>>   origin/master\n>>>>\n>>>> .git/config:\n>>>>\n>>>> [core]\n>>>>         repositoryformatversion = 0\n>>>>         filemode = true\n>>>>         bare = false\n>>>>         logallrefupdates = true\n>>>> [remote \"origin\"]\n>>>>         url = https://mysite/git/project.git\n>>>>         fetch = +refs/heads/*:refs/remotes/origin/*\n>>>> [branch \"master\"]\n>>>>         remote = origin\n>>>>         merge = refs/heads/master\n>>>>\n>>>> But the initial local repository where I work (ie created the branches,\n>>>> committed changes, tag, push etc) seems to be fine, ie\n>>>>\n>>>>> git checkout upstream\n>>>> Switched to branch \"upstream\"\n>>>>\n>>>>> git branch -a\n>>>>   custom\n>>>> * master\n>>>>   upstream\n>>>>\n>>>> .git/config:\n>>>>\n>>>> [core]\n>>>>         repositoryformatversion = 0\n>>>>         filemode = true\n>>>>         bare = false\n>>>>         logallrefupdates = true\n>>>> [remote \"origin\"]\n>>>>         url = https://mysite/git/project.git\n>>>>         fetch = +refs/heads/*:refs/remotes/origin/*\n>>>>\n>>>>\n>>>> Developers need to be able to clone the repository and then switch to\n>>>> the appropriate branch in order to work. However it seems that after a\n>>>> clone, only the master branch is available.\n>>>>\n>>>> Why is this?\n>>>>\n>>>> Any help would be much appreciated indeed.\n>>> If I understand you correctly you have 3 repos: the \"initial\" one on\n>>> which everything is as expected, the \"server\" one and the \"new clone\"\n>>> which is missing branches.\n>> Yes, that's correct.\n>>\n>>> Now: How's the server one doing, i.e. what does \"git ls-remote\n>>> https://mysite/git/project.git\" say? I suspect that one either does not\n>>> have the branches (you haven't told us how you pushed) or in the wrong\n>>> place (remotes/).\n>>> git ls-remote https://mysite/git/project.git\n>> 065f5f13d5f8e786729db1623cc53767c963e959        HEAD\n>> 065f5f13d5f8e786729db1623cc53767c963e959        refs/heads/master\n>>\n>> Hmm. So it seems that the branches are not actually on the server\n>> repository. So how come I can see them with gitweb..?\n>>\n>> I've been pushing from the 'initial' repository with git push --all and\n>> git push --tags.\n>>\n>> However, when I try a git push from the initial repository I get the\n>> following:\n>>\n>>> git push --all\n>> Fetching remote heads...\n>>   refs/\n>>   refs/heads/\n>>   refs/tags/\n>> 'refs/heads/custom': up-to-date\n>> 'refs/heads/master': up-to-date\n>> 'refs/heads/upstream': up-to-date\n>>\n>> -- Matt\n> \n> Does the situation improve if, on the server, you run git\n> update-server-info? Do you have a post-update hook there?\n> \n> Michael\n\nI ran git update-server-info on the server machine. I read about this\nand thought I had made the necessary change to add it as a post commit\nhook. I guess not (so will double check). However, something is still\nnot quite right upon cloning:\n\n> git clone https://mysite/git/project.git\nInitialized empty Git repository in /home/matt/git-repos/project/.git/\nChecking out files: 100% (26747/26747), done.\n\n> git branch -a\n* master\n  origin/HEAD\n  origin/custom\n  origin/master\n  origin/upstream\n\n> git checkout upstream\nerror: pathspec 'upstream' did not match any file(s) known to git.\n\nSo it seems that the cloned repository is now aware of the branches\n(improvement) but I'm still unable to switch to a branch.\n\nThis is probably now a case of me reading the manual but I'd appreciate\nyour thoughts nonetheless.\n\nThanks for your continued feedback,\n--  Matt\n"},{"id":"120271","messageId":"4A818119.6000302@drmicha.warpmail.net","threadId":"20530","inReplyTo":"4A817F3B.7070308@bubblegen.co.uk","subject":"Re: Unable to checkout a branch after cloning","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-08-11T14:32:57Z","receivedAt":"2009-08-11T14:32:57Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Matthew Lear venit, vidit, dixit 11.08.2009 16:24:\n> Michael J Gruber wrote:\n>> Matthew Lear venit, vidit, dixit 11.08.2009 14:17:\n>>> Hi Michael - thanks for your reply.\n>>> Michael J Gruber wrote:\n>>>> Matthew Lear venit, vidit, dixit 11.08.2009 12:10:\n>>>>> Hi all,\n>>>>>\n>>>>> Apologies for perhaps a silly question, but I'd very much appreciate a\n>>>>> little bit of assistance.\n>>>>>\n>>>>> I've set up a git repository on a machine accessible from the internet\n>>>>> with the intention to share code with another developer. We clone the\n>>>>> repository, commit changes then push back as you'd expect. The server\n>>>>> runs gitweb for repository browsing. Clients are running git v1.6.0.6.\n>>>>>\n>>>>> When I created the initial repository I also created two additional\n>>>>> branches - 'upstream' and 'custom'. The former is to act as a 'vendor\n>>>>> branch' and the latter contains code specific to the custom platform\n>>>>> that we're working on. The master branch contains merges from the\n>>>>> upstream branch and also changes that we've made. The custom branch\n>>>>> contains merges from master with custom platform specific changes.\n>>>>>\n>>>>> I've committed changes and on both upstream and custom branches as work\n>>>>> progressed, merged them where appropriate, added tags etc and pushed\n>>>>> everything to the remote repository. No problem. I can view the\n>>>>> branches, tags etc in gitweb and everything looks fine.\n>>>>>\n>>>>> However, I can clone a new repository just fine but I'm unable to\n>>>>> checkout the upstream or custom branches. After cloning, only the master\n>>>>> branch is available, ie:\n>>>>>\n>>>>>> git checkout upstream\n>>>>> error: pathspec 'upstream' did not match any file(s) known to git.\n>>>>>\n>>>>>> git branch -a\n>>>>> * master\n>>>>>   origin/HEAD\n>>>>>   origin/master\n>>>>>\n>>>>> .git/config:\n>>>>>\n>>>>> [core]\n>>>>>         repositoryformatversion = 0\n>>>>>         filemode = true\n>>>>>         bare = false\n>>>>>         logallrefupdates = true\n>>>>> [remote \"origin\"]\n>>>>>         url = https://mysite/git/project.git\n>>>>>         fetch = +refs/heads/*:refs/remotes/origin/*\n>>>>> [branch \"master\"]\n>>>>>         remote = origin\n>>>>>         merge = refs/heads/master\n>>>>>\n>>>>> But the initial local repository where I work (ie created the branches,\n>>>>> committed changes, tag, push etc) seems to be fine, ie\n>>>>>\n>>>>>> git checkout upstream\n>>>>> Switched to branch \"upstream\"\n>>>>>\n>>>>>> git branch -a\n>>>>>   custom\n>>>>> * master\n>>>>>   upstream\n>>>>>\n>>>>> .git/config:\n>>>>>\n>>>>> [core]\n>>>>>         repositoryformatversion = 0\n>>>>>         filemode = true\n>>>>>         bare = false\n>>>>>         logallrefupdates = true\n>>>>> [remote \"origin\"]\n>>>>>         url = https://mysite/git/project.git\n>>>>>         fetch = +refs/heads/*:refs/remotes/origin/*\n>>>>>\n>>>>>\n>>>>> Developers need to be able to clone the repository and then switch to\n>>>>> the appropriate branch in order to work. However it seems that after a\n>>>>> clone, only the master branch is available.\n>>>>>\n>>>>> Why is this?\n>>>>>\n>>>>> Any help would be much appreciated indeed.\n>>>> If I understand you correctly you have 3 repos: the \"initial\" one on\n>>>> which everything is as expected, the \"server\" one and the \"new clone\"\n>>>> which is missing branches.\n>>> Yes, that's correct.\n>>>\n>>>> Now: How's the server one doing, i.e. what does \"git ls-remote\n>>>> https://mysite/git/project.git\" say? I suspect that one either does not\n>>>> have the branches (you haven't told us how you pushed) or in the wrong\n>>>> place (remotes/).\n>>>> git ls-remote https://mysite/git/project.git\n>>> 065f5f13d5f8e786729db1623cc53767c963e959        HEAD\n>>> 065f5f13d5f8e786729db1623cc53767c963e959        refs/heads/master\n>>>\n>>> Hmm. So it seems that the branches are not actually on the server\n>>> repository. So how come I can see them with gitweb..?\n>>>\n>>> I've been pushing from the 'initial' repository with git push --all and\n>>> git push --tags.\n>>>\n>>> However, when I try a git push from the initial repository I get the\n>>> following:\n>>>\n>>>> git push --all\n>>> Fetching remote heads...\n>>>   refs/\n>>>   refs/heads/\n>>>   refs/tags/\n>>> 'refs/heads/custom': up-to-date\n>>> 'refs/heads/master': up-to-date\n>>> 'refs/heads/upstream': up-to-date\n>>>\n>>> -- Matt\n>>\n>> Does the situation improve if, on the server, you run git\n>> update-server-info? Do you have a post-update hook there?\n>>\n>> Michael\n> \n> I ran git update-server-info on the server machine. I read about this\n> and thought I had made the necessary change to add it as a post commit\n> hook. I guess not (so will double check). However, something is still\n> not quite right upon cloning:\n> \n>> git clone https://mysite/git/project.git\n> Initialized empty Git repository in /home/matt/git-repos/project/.git/\n> Checking out files: 100% (26747/26747), done.\n> \n>> git branch -a\n> * master\n>   origin/HEAD\n>   origin/custom\n>   origin/master\n>   origin/upstream\n\nWe're making progress, that's good ;)\nRe. the hook: Make sure it's executable and the extension .sample is\nremoved.\n\n(gitweb and http access are two different things, which is a common\nsource of confusion)\n\n> \n>> git checkout upstream\n> error: pathspec 'upstream' did not match any file(s) known to git.\n> \n> So it seems that the cloned repository is now aware of the branches\n> (improvement) but I'm still unable to switch to a branch.\n> \n> This is probably now a case of me reading the manual but I'd appreciate\n> your thoughts nonetheless.\n\nWell, there is no branch names upstream. There's only one named\norigin/upstream, and it's a remote branch. Meaning: checking it out will\nproduce a detached head, which may or may not be what you want. If you\nwant to create a branch to work on upstream, do something like\n\ngit checkout -b myupstream origin/upstream\n\n(git does something like git checkout -b master origin/master\nautomatically when cloning, which I think is a common source of confusion)\n\n> Thanks for your continued feedback,\n> --  Matt\n\nCheers,\nMichael\n"},{"id":"120274","messageId":"4A818638.8060806@bubblegen.co.uk","threadId":"20530","inReplyTo":"4A818119.6000302@drmicha.warpmail.net","subject":"Re: Unable to checkout a branch after cloning","fromName":"Matthew Lear","fromEmail":"matt@bubblegen.co.uk","sentAt":"2009-08-11T14:54:48Z","receivedAt":"2009-08-11T14:54:48Z","isPatch":false,"sender":{"key":"matt@bubblegen.co.uk","avatar":null},"body":"Michael J Gruber wrote:\n> Matthew Lear venit, vidit, dixit 11.08.2009 16:24:\n>> Michael J Gruber wrote:\n>>> Matthew Lear venit, vidit, dixit 11.08.2009 14:17:\n>>>> Hi Michael - thanks for your reply.\n>>>> Michael J Gruber wrote:\n>>>>> Matthew Lear venit, vidit, dixit 11.08.2009 12:10:\n>>>>>> Hi all,\n>>>>>>\n>>>>>> Apologies for perhaps a silly question, but I'd very much appreciate a\n>>>>>> little bit of assistance.\n>>>>>>\n>>>>>> I've set up a git repository on a machine accessible from the internet\n>>>>>> with the intention to share code with another developer. We clone the\n>>>>>> repository, commit changes then push back as you'd expect. The server\n>>>>>> runs gitweb for repository browsing. Clients are running git v1.6.0.6.\n>>>>>>\n>>>>>> When I created the initial repository I also created two additional\n>>>>>> branches - 'upstream' and 'custom'. The former is to act as a 'vendor\n>>>>>> branch' and the latter contains code specific to the custom platform\n>>>>>> that we're working on. The master branch contains merges from the\n>>>>>> upstream branch and also changes that we've made. The custom branch\n>>>>>> contains merges from master with custom platform specific changes.\n>>>>>>\n>>>>>> I've committed changes and on both upstream and custom branches as work\n>>>>>> progressed, merged them where appropriate, added tags etc and pushed\n>>>>>> everything to the remote repository. No problem. I can view the\n>>>>>> branches, tags etc in gitweb and everything looks fine.\n>>>>>>\n>>>>>> However, I can clone a new repository just fine but I'm unable to\n>>>>>> checkout the upstream or custom branches. After cloning, only the master\n>>>>>> branch is available, ie:\n>>>>>>\n>>>>>>> git checkout upstream\n>>>>>> error: pathspec 'upstream' did not match any file(s) known to git.\n>>>>>>\n>>>>>>> git branch -a\n>>>>>> * master\n>>>>>>   origin/HEAD\n>>>>>>   origin/master\n>>>>>>\n>>>>>> .git/config:\n>>>>>>\n>>>>>> [core]\n>>>>>>         repositoryformatversion = 0\n>>>>>>         filemode = true\n>>>>>>         bare = false\n>>>>>>         logallrefupdates = true\n>>>>>> [remote \"origin\"]\n>>>>>>         url = https://mysite/git/project.git\n>>>>>>         fetch = +refs/heads/*:refs/remotes/origin/*\n>>>>>> [branch \"master\"]\n>>>>>>         remote = origin\n>>>>>>         merge = refs/heads/master\n>>>>>>\n>>>>>> But the initial local repository where I work (ie created the branches,\n>>>>>> committed changes, tag, push etc) seems to be fine, ie\n>>>>>>\n>>>>>>> git checkout upstream\n>>>>>> Switched to branch \"upstream\"\n>>>>>>\n>>>>>>> git branch -a\n>>>>>>   custom\n>>>>>> * master\n>>>>>>   upstream\n>>>>>>\n>>>>>> .git/config:\n>>>>>>\n>>>>>> [core]\n>>>>>>         repositoryformatversion = 0\n>>>>>>         filemode = true\n>>>>>>         bare = false\n>>>>>>         logallrefupdates = true\n>>>>>> [remote \"origin\"]\n>>>>>>         url = https://mysite/git/project.git\n>>>>>>         fetch = +refs/heads/*:refs/remotes/origin/*\n>>>>>>\n>>>>>>\n>>>>>> Developers need to be able to clone the repository and then switch to\n>>>>>> the appropriate branch in order to work. However it seems that after a\n>>>>>> clone, only the master branch is available.\n>>>>>>\n>>>>>> Why is this?\n>>>>>>\n>>>>>> Any help would be much appreciated indeed.\n>>>>> If I understand you correctly you have 3 repos: the \"initial\" one on\n>>>>> which everything is as expected, the \"server\" one and the \"new clone\"\n>>>>> which is missing branches.\n>>>> Yes, that's correct.\n>>>>\n>>>>> Now: How's the server one doing, i.e. what does \"git ls-remote\n>>>>> https://mysite/git/project.git\" say? I suspect that one either does not\n>>>>> have the branches (you haven't told us how you pushed) or in the wrong\n>>>>> place (remotes/).\n>>>>> git ls-remote https://mysite/git/project.git\n>>>> 065f5f13d5f8e786729db1623cc53767c963e959        HEAD\n>>>> 065f5f13d5f8e786729db1623cc53767c963e959        refs/heads/master\n>>>>\n>>>> Hmm. So it seems that the branches are not actually on the server\n>>>> repository. So how come I can see them with gitweb..?\n>>>>\n>>>> I've been pushing from the 'initial' repository with git push --all and\n>>>> git push --tags.\n>>>>\n>>>> However, when I try a git push from the initial repository I get the\n>>>> following:\n>>>>\n>>>>> git push --all\n>>>> Fetching remote heads...\n>>>>   refs/\n>>>>   refs/heads/\n>>>>   refs/tags/\n>>>> 'refs/heads/custom': up-to-date\n>>>> 'refs/heads/master': up-to-date\n>>>> 'refs/heads/upstream': up-to-date\n>>>>\n>>>> -- Matt\n>>> Does the situation improve if, on the server, you run git\n>>> update-server-info? Do you have a post-update hook there?\n>>>\n>>> Michael\n>> I ran git update-server-info on the server machine. I read about this\n>> and thought I had made the necessary change to add it as a post commit\n>> hook. I guess not (so will double check). However, something is still\n>> not quite right upon cloning:\n>>\n>>> git clone https://mysite/git/project.git\n>> Initialized empty Git repository in /home/matt/git-repos/project/.git/\n>> Checking out files: 100% (26747/26747), done.\n>>\n>>> git branch -a\n>> * master\n>>   origin/HEAD\n>>   origin/custom\n>>   origin/master\n>>   origin/upstream\n> \n> We're making progress, that's good ;)\n> Re. the hook: Make sure it's executable and the extension .sample is\n> removed.\n> \n> (gitweb and http access are two different things, which is a common\n> source of confusion)\n> \n>>> git checkout upstream\n>> error: pathspec 'upstream' did not match any file(s) known to git.\n>>\n>> So it seems that the cloned repository is now aware of the branches\n>> (improvement) but I'm still unable to switch to a branch.\n>>\n>> This is probably now a case of me reading the manual but I'd appreciate\n>> your thoughts nonetheless.\n> \n> Well, there is no branch names upstream. There's only one named\n> origin/upstream, and it's a remote branch. Meaning: checking it out will\n> produce a detached head, which may or may not be what you want. If you\n> want to create a branch to work on upstream, do something like\n> \n> git checkout -b myupstream origin/upstream\n> \n> (git does something like git checkout -b master origin/master\n> automatically when cloning, which I think is a common source of confusion)\n\nI've fixed the server hook scripts (embarrassingly, they were executable\nbut still had the .sample suffix - that's really not going to work!).\n\nI've actually just read through the manual about detached heads. This is\nnot what I want but your solution to create a branch to track the remote\nbranch is exactly what I need.\n\nWhere ever you are in the world, many thanks for your continued help and\nassistance. Very much appreciated indeed.\n\nCheers,\n--  Matt\n"}]}