{"thread":{"id":"1980","subject":"git push to a local directory with no .git in it","startedAt":"2005-09-29T23:25:59Z","lastAt":"2005-09-30T22:51:26Z","messageCount":3,"participants":["Richard Curnow","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"9518","messageId":"loom.20050930T011606-58@post.gmane.org","threadId":"1980","inReplyTo":null,"subject":"git push to a local directory with no .git in it","fromName":"Richard Curnow","fromEmail":"rc@rc0.org.uk","sentAt":"2005-09-29T23:25:59Z","receivedAt":"2005-09-29T23:25:59Z","isPatch":false,"sender":{"key":"rc@rc0.org.uk","avatar":null},"body":"Background: I have to use plain FTP to upload content to my web site.  I keep a\nlocal mirror of the entire site, then use an automated upload mechanism to do\nthe FTP step.\n\nTo release a git repository onto my site, I want to 'git push' from my working\narea to the release area in the local mirror.  So what ends up as\n\n    http://www.rpcurnow.force9.co.uk/git/mairix.git\n\nlives in ~/homepage/git/mairix.git locally.  That directory contains\nHEAD, refs, objects, hooks; I don't have a .git subdirectory in the middle.\n\nIf I cd to ~/gitwork/mairix (which is a regular working area) and do\n\n    git push ~/homepage/git/mairix.git master:master\n\nI get\n\nfatal: /home/richard/homepage/git/mairix.git doesn't appear to be a git directory\n\npresumably because there is no .git in it.\n\nI could cd to ~/homepage/git/mairix.git and do things like\n\n    GIT_DIR=. gitk --all\n\nbut what's the equivalent of this GIT_DIR trick when it's the remote end of\na 'git push' that has the problem?\n\nCheers\nRichard\n"},{"id":"9522","messageId":"7v7jcze7xu.fsf@assigned-by-dhcp.cox.net","threadId":"1980","inReplyTo":"loom.20050930T011606-58@post.gmane.org","subject":"Re: git push to a local directory with no .git in it","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-09-30T00:05:33Z","receivedAt":"2005-09-30T00:05:33Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Richard Curnow <rc@rc0.org.uk> writes:\n\n> I get\n>\n> fatal: /home/richard/homepage/git/mairix.git doesn't appear to be a git directory\n>\n> presumably because there is no .git in it.\n\nPlease don't presume, but dig.\n\n        $ git grep -n 'doesn.t appear to be'\n        receive-pack.c:275:\t\tdie(\"%s doesn't appear to be a git directory\", dir);\n\nAnd the lines around there are:\n\n\t/* chdir to the directory. If that fails, try appending \".git\" */\n\tif (chdir(dir) < 0) {\n\t\tif (chdir(mkpath(\"%s.git\", dir)) < 0)\n\t\t\tdie(\"unable to cd to %s\", dir);\n\t}\n\n\t/* If we have a \".git\" directory, chdir to it */\n\tchdir(\".git\");\n\tputenv(\"GIT_DIR=.\");\n\n\tif (access(\"objects\", X_OK) < 0 || access(\"refs/heads\", X_OK) < 0)\n\t\tdie(\"%s doesn't appear to be a git directory\", dir);\n\twrite_head_info();\n\nWe chdir to mairix.git/, and then try to chdir to .git beneath\nit _if_ _exists_; we do not care if the second chdir fails.  So\nif you do not have mairix.git/.git, that's OK.  We will stay in\nmairix.git/ directory and then set the GIT_DIR there.\n\nIf you do not have mairix.git/objects or mairix.git/refs/heads/\nthen that's when you get that error message.\n\n\t$ cd /home/richard/homepage/git/mairix.git\n        $ ls -ld objects refs refs/heads\n\nwould tell us more.\n\n        \n"},{"id":"9569","messageId":"loom.20051001T000906-187@post.gmane.org","threadId":"1980","inReplyTo":"7v7jcze7xu.fsf@assigned-by-dhcp.cox.net","subject":"Re: git push to a local directory with no .git in it","fromName":"Richard Curnow","fromEmail":"rc@rc0.org.uk","sentAt":"2005-09-30T22:51:26Z","receivedAt":"2005-09-30T22:51:26Z","isPatch":false,"sender":{"key":"rc@rc0.org.uk","avatar":null},"body":"Junio C Hamano <junkio <at> cox.net> writes:\n\n> \n> Please don't presume, but dig.\n\nYes, sorry.  It was late...\n\n> \n> If you do not have mairix.git/objects or mairix.git/refs/heads/\n> then that's when you get that error message.\n\nIn fact, it turned out that I did still had a .git under mairix.git, but I'd\nmv'd its contents up to the mairix.git level and forgotten to delete the .git\ndirectory.  Doh.\n\nThanks for your help, anyway.  It was a very strong clue what to look for.\n\nRichard\n"}]}