* git push to a local directory with no .git in it
@ 2005-09-29 23:25 Richard Curnow
2005-09-30 0:05 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Richard Curnow @ 2005-09-29 23:25 UTC (permalink / raw)
To: git
Background: I have to use plain FTP to upload content to my web site. I keep a
local mirror of the entire site, then use an automated upload mechanism to do
the FTP step.
To release a git repository onto my site, I want to 'git push' from my working
area to the release area in the local mirror. So what ends up as
http://www.rpcurnow.force9.co.uk/git/mairix.git
lives in ~/homepage/git/mairix.git locally. That directory contains
HEAD, refs, objects, hooks; I don't have a .git subdirectory in the middle.
If I cd to ~/gitwork/mairix (which is a regular working area) and do
git push ~/homepage/git/mairix.git master:master
I get
fatal: /home/richard/homepage/git/mairix.git doesn't appear to be a git directory
presumably because there is no .git in it.
I could cd to ~/homepage/git/mairix.git and do things like
GIT_DIR=. gitk --all
but what's the equivalent of this GIT_DIR trick when it's the remote end of
a 'git push' that has the problem?
Cheers
Richard
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: git push to a local directory with no .git in it
2005-09-29 23:25 git push to a local directory with no .git in it Richard Curnow
@ 2005-09-30 0:05 ` Junio C Hamano
2005-09-30 22:51 ` Richard Curnow
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2005-09-30 0:05 UTC (permalink / raw)
To: Richard Curnow; +Cc: git
Richard Curnow <rc@rc0.org.uk> writes:
> I get
>
> fatal: /home/richard/homepage/git/mairix.git doesn't appear to be a git directory
>
> presumably because there is no .git in it.
Please don't presume, but dig.
$ git grep -n 'doesn.t appear to be'
receive-pack.c:275: die("%s doesn't appear to be a git directory", dir);
And the lines around there are:
/* chdir to the directory. If that fails, try appending ".git" */
if (chdir(dir) < 0) {
if (chdir(mkpath("%s.git", dir)) < 0)
die("unable to cd to %s", dir);
}
/* If we have a ".git" directory, chdir to it */
chdir(".git");
putenv("GIT_DIR=.");
if (access("objects", X_OK) < 0 || access("refs/heads", X_OK) < 0)
die("%s doesn't appear to be a git directory", dir);
write_head_info();
We chdir to mairix.git/, and then try to chdir to .git beneath
it _if_ _exists_; we do not care if the second chdir fails. So
if you do not have mairix.git/.git, that's OK. We will stay in
mairix.git/ directory and then set the GIT_DIR there.
If you do not have mairix.git/objects or mairix.git/refs/heads/
then that's when you get that error message.
$ cd /home/richard/homepage/git/mairix.git
$ ls -ld objects refs refs/heads
would tell us more.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: git push to a local directory with no .git in it
2005-09-30 0:05 ` Junio C Hamano
@ 2005-09-30 22:51 ` Richard Curnow
0 siblings, 0 replies; 3+ messages in thread
From: Richard Curnow @ 2005-09-30 22:51 UTC (permalink / raw)
To: git
Junio C Hamano <junkio <at> cox.net> writes:
>
> Please don't presume, but dig.
Yes, sorry. It was late...
>
> If you do not have mairix.git/objects or mairix.git/refs/heads/
> then that's when you get that error message.
In fact, it turned out that I did still had a .git under mairix.git, but I'd
mv'd its contents up to the mairix.git level and forgotten to delete the .git
directory. Doh.
Thanks for your help, anyway. It was a very strong clue what to look for.
Richard
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-09-30 22:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-29 23:25 git push to a local directory with no .git in it Richard Curnow
2005-09-30 0:05 ` Junio C Hamano
2005-09-30 22:51 ` Richard Curnow
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox