{"thread":{"id":"1717","subject":"[PROBLEM] Checkout from cloned repository does not work","startedAt":"2005-09-02T11:20:32Z","lastAt":"2005-09-03T07:43:02Z","messageCount":5,"participants":["Pekka Enberg","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"8015","messageId":"84144f0205090204201f74e425@mail.gmail.com","threadId":"1717","inReplyTo":null,"subject":"[PROBLEM] Checkout from cloned repository does not work","fromName":"Pekka Enberg","fromEmail":"penberg@cs.helsinki.fi","sentAt":"2005-09-02T11:20:32Z","receivedAt":"2005-09-02T11:20:32Z","isPatch":false,"sender":{"key":"penberg@cs.helsinki.fi","avatar":"https://gravatar.com/avatar/85c22f5836e27e3fa9136f0ba21ea177570fa170ef60ab3dd1c1a36b4d63e516?d=mp&s=160"},"body":"Hi,\n\nI cannot checkout from a cloned git repository I have created. I am\nusing git 0.99.5 from Gentoo portage.\n\nFollowing the tutorial, I create new git repository:\n\n  $ mkdir git-test\n  $ cd git-test/\n  $ git-init-db\n  defaulting to local storage area\n  $ echo \"Hello, Git\" > hello\n  $ git-update-cache --add hello\n  $ git-write-tree\n  4bd2134df7a908d2764f70d155e32650954cfc72\n  $ echo \"Initial commit\" | git-commit-tree\n4bd2134df7a908d2764f70d155e32650954cfc72 > .git/HEAD\n  Committing initial tree 4bd2134df7a908d2764f70d155e32650954cfc72\n\nNow on the server, I create a repository:\n\n  $ mkdir git-test.git\n  GIT_DIR=git-test.git/ git-init-db\n\nThen I push my local repository to remote server like this:\n\n  $ git push ssh.remote.server:/home/penberg/public_html/git-test.git master\n  Password:\n  updating 'refs/heads/master'\n    from 0000000000000000000000000000000000000000\n    to   8744316e49411509ba28e9cf567f3aec5833ec74\n  Packing 3 objects\n  Unpacking 3 objects\n   100% (3/3) done\n  refs/heads/master: 0000000000000000000000000000000000000000 ->\n8744316e49411509ba28e9cf567f3aec5833ec74\n\nAfter which I clone the newly created repository like this:\n\n  $ git clone http://www.remote.server/~penberg/git-test.git cloned\n  defaulting to local storage area\n  Somebody should define smarter http server protocol\n\nNow, the problem is that checkout does not work:\n\n  $ git checkout\n  usage: git-read-tree (<sha> | -m [-u] <sha1> [<sha2> [<sha3>]])\n\nThat's because I have no HEAD:\n\n  $ ls -l .git/HEAD\n  lrwxrwxrwx  1 penberg users 17 Sep  2 14:07 .git/HEAD -> refs/heads/master\n\n  $ ls -l .git/refs/heads/\n  total 0\n\nWhat am I doing wrong here? Doing a git pull causes the following error:\n\n  $ git pull http://www.remote.server/~penberg/git-test.git\n  Fetching HEAD from http://www.remote.server/~penberg/git-test.git using http\n  got 8744316e49411509ba28e9cf567f3aec5833ec74\n  got 4bd2134df7a908d2764f70d155e32650954cfc72\n  got b7aec520dec0a7516c18eb4c68b64ae1eb9b5a5e\n  * committish: 8744316e49411509ba28e9cf567f3aec5833ec74  HEAD from\nhttp://www.remote.server/~penberg/git-test.git\n  cat: .git/HEAD: No such file or directory\n  fatal: Needed a single revision\n  git-resolve-script <head> <remote> <merge-message>\n\n                                       Pekka\n"},{"id":"8021","messageId":"7vpsrrgwxb.fsf@assigned-by-dhcp.cox.net","threadId":"1717","inReplyTo":"84144f0205090204201f74e425@mail.gmail.com","subject":"Re: [PROBLEM] Checkout from cloned repository does not work","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-09-02T18:13:36Z","receivedAt":"2005-09-02T18:13:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pekka Enberg <penberg@cs.helsinki.fi> writes:\n\n> I cannot checkout from a cloned git repository I have created. I am\n> using git 0.99.5 from Gentoo portage.\n\n> Following the tutorial, I create new git repository:\n>...\n> Now on the server, I create a repository:\n>\n>   $ mkdir git-test.git\n>   GIT_DIR=git-test.git/ git-init-db\n\nYou would need 'chmod +x git-test.git/hooks/post-update' here if\nyou are allowing people to pull over http from this repository.\n\nI just realized that where this was documented was quite obscure\nin the tutorial.  I'll update it with the appended patch.\n\n> After which I clone the newly created repository like this:\n>\n>   $ git clone http://www.remote.server/~penberg/git-test.git cloned\n>   defaulting to local storage area\n>   Somebody should define smarter http server protocol\n>\n> Now, the problem is that checkout does not work:\n\nThe problem is that 'git clone' does not support cloning over\nhttp from servers that are not properly prepared.  This 'git\nclone' exited with non-zero status with an error message, didn't\nit?\n\n-->8-- -->8-- -->8--\nMention post-update when we first talk about publishing a repository.\n\nThere is more detailed instruction for `project lead` later in\nthe tutorial to talk about the same, but at this point in the\nflow of tutorial, the first time reader has no way of knowing it.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\ndiff --git a/Documentation/tutorial.txt b/Documentation/tutorial.txt\n--- a/Documentation/tutorial.txt\n+++ b/Documentation/tutorial.txt\n@@ -1103,6 +1103,12 @@ your login shell is `bash`, only `.bashr\n `.bash_profile`. As a workaround, make sure `.bashrc` sets up\n `$PATH` so that you can run `git-receive-pack` program.\n \n+[NOTE]\n+If you plan to publish this repository to be accessed over http,\n+you should do `chmod +x my-git.git/hooks/post-update` at this\n+point.  This makes sure that every time you push into this\n+repository, `git-update-server-info` is run.\n+\n Your \"public repository\" is now ready to accept your changes.\n Come back to the machine you have your private repository. From\n there, run this command:\n"},{"id":"8030","messageId":"1125730179.29087.3.camel@localhost","threadId":"1717","inReplyTo":"7vpsrrgwxb.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PROBLEM] Checkout from cloned repository does not work","fromName":"Pekka Enberg","fromEmail":"penberg@cs.helsinki.fi","sentAt":"2005-09-03T06:49:38Z","receivedAt":"2005-09-03T06:49:38Z","isPatch":false,"sender":{"key":"penberg@cs.helsinki.fi","avatar":"https://gravatar.com/avatar/85c22f5836e27e3fa9136f0ba21ea177570fa170ef60ab3dd1c1a36b4d63e516?d=mp&s=160"},"body":"Hi Junio,\n\nOn Fri, 2005-09-02 at 11:13 -0700, Junio C Hamano wrote:\n> You would need 'chmod +x git-test.git/hooks/post-update' here if\n> you are allowing people to pull over http from this repository.\n\nAah, thanks! That fixed it for me.\n\nOn Fri, 2005-09-02 at 11:13 -0700, Junio C Hamano wrote:\n> The problem is that 'git clone' does not support cloning over\n> http from servers that are not properly prepared.  This 'git\n> clone' exited with non-zero status with an error message, didn't\n> it?\n\nI double checked that -- no, it does not print out an error. I copied\nthe exact output in the original mail. \n\nOn Fri, 2005-09-02 at 11:13 -0700, Junio C Hamano wrote:\n> +[NOTE]\n> +If you plan to publish this repository to be accessed over http,\n> +you should do `chmod +x my-git.git/hooks/post-update` at this\n> +point.\n\nHow about \"must do chmod before pushing anything to this repository\"? I\nthink I tried chmod at some point but always did it too late (i.e. after\nthe initial push).\n\n\t\t\tPekka\n"},{"id":"8032","messageId":"7vmzmua9ow.fsf@assigned-by-dhcp.cox.net","threadId":"1717","inReplyTo":"1125730179.29087.3.camel@localhost","subject":"Re: [PROBLEM] Checkout from cloned repository does not work","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-09-03T07:31:59Z","receivedAt":"2005-09-03T07:31:59Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pekka Enberg <penberg@cs.helsinki.fi> writes:\n\n> I double checked that -- no, it does not print out an error. I copied\n> the exact output in the original mail. \n\nWhich ended with the error message \"Somebody should define\nsmarter http server protocol\".  That's from git-clone-script and\nthe echo to generate the output is followed by \"exit 1\".\n\n>> +[NOTE]\n>> +If you plan to publish this repository to be accessed over http,\n>> +you should do `chmod +x my-git.git/hooks/post-update` at this\n>> +point.\n>\n> How about \"must do chmod before pushing anything to this repository\"? I\n> think I tried chmod at some point but always did it too late (i.e. after\n> the initial push).\n\nI think \"at this point\" in the flow of tutorial text would be\nexplicit enough, but I am not very good at writing\ndocumentation, so rewording/clarifying patches are always\nwelcome.\n\nYou could always run git-update-server-info manually after\npushing if you forgot to enable the hook.  If you are paranoid\nyou could run it with '-f' flag to rebuild the info from\nscratch.\n"},{"id":"8033","messageId":"1125733383.29087.8.camel@localhost","threadId":"1717","inReplyTo":"7vmzmua9ow.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PROBLEM] Checkout from cloned repository does not work","fromName":"Pekka Enberg","fromEmail":"penberg@cs.helsinki.fi","sentAt":"2005-09-03T07:43:02Z","receivedAt":"2005-09-03T07:43:02Z","isPatch":false,"sender":{"key":"penberg@cs.helsinki.fi","avatar":"https://gravatar.com/avatar/85c22f5836e27e3fa9136f0ba21ea177570fa170ef60ab3dd1c1a36b4d63e516?d=mp&s=160"},"body":"On Sat, 2005-09-03 at 00:31 -0700, Junio C Hamano wrote:\n> Which ended with the error message \"Somebody should define\n> smarter http server protocol\".  That's from git-clone-script and\n> the echo to generate the output is followed by \"exit 1\".\n\nOh, I just didn't realize that was an error message. Perhaps it could\nhave an \"Error\" prefix and an explanation that the repository was not\ncloned properly.\n\nAnyway, thanks for the help!\n\n\t\t\tPekka\n"}]}