threads / discuss / 21262

Moving git

Subject: Moving git

## tl;dr

11 messages between Oct 16, 2009 and Oct 20, 2009.

replies: 10people: 5as markdown or json

Richard Lee· Oct 16, 2009, 14:58 UTC · lore
Hi Git forum,

I've just started using git yesterday, so I'm very new. So please excuse if I've done something the wrong way.

I cloned a git directory/repository? and then moved it. I'm trying to prune branches and it gives

]fatal: '/var/www/vhosts/mydomain.co.uk/b2.git': unable to chdir or not a git archive fatal: The remote end hung up unexpectedly ls-remote --heads /var/www/vhosts/mydomain.co.uk/b2.git: command returned error: 1

b2.git was the cloned bare thing I create following the instruction here:
http://book.git-scm.com/4_setting_up_a_private_repository.html
Is there someway I can get git to update the git base directory?
Richard
-- 
View this message in context: http://www.nabble.com/Moving-git-tp25926819p25926819.html
Sent from the git mailing list archive at Nabble.com.
Matthieu Moy· Oct 16, 2009, 15:17 UTC · re: Richard Lee · lore

Re: Moving git

Richard Lee <richard@webdezign.co.uk> writes:
Show 7 quoted lines
> Hi Git forum,
>
> I've just started using git yesterday, so I'm very new. So please excuse if
> I've done something the wrong way.
>
> I cloned a git directory/repository? and then moved it. I'm trying to prune
> branches and it gives
Which command did you type?
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Richard· Oct 16, 2009, 15:45 UTC · re: Matthieu Moy · lore

RE: Moving git

Hi Matthieu,
Thanks for replying.

Basically, I used git-svn to import from git. I'm trying to get rid of the origin branch. (I probably should have used the no-metdata switch).

The command I used was
git branch prune origin

I tried "git remote rm origin" which worked on my local win32 machine, but the linux server I was working on did not recognise "git remote rm".

I'm pretty sure git stores the current git directory as I've seen the --git-dir and --work-tree environment variables. Plus I also noticed on msysgit gives " Local uncommitted changes, not checked in to index" sometimes, when I move the directory.

Regards,
Richard
-----Original Message-----
From: Matthieu Moy [mailto:Matthieu.Moy@grenoble-inp.fr] 
Sent: 16 October 2009 16:17
To: Richard
Cc: git@vger.kernel.org
Subject: Re: Moving git
Richard Lee <richard@webdezign.co.uk> writes:
> Hi Git forum,
>
> I've just started using git yesterday, so I'm very new. So please
excuse if
> I've done something the wrong way.
>
> I cloned a git directory/repository? and then moved it. I'm trying to
prune
> branches and it gives
Which command did you type?
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Matthieu Moy· Oct 16, 2009, 16:11 UTC · re: Richard · lore

Re: Moving git

"Richard" <richard@webdezign.co.uk> writes:
Show 17 quoted lines
> Hi Matthieu,
>
>
> Thanks for replying.
>
> Basically, I used git-svn to import from git. I'm trying to get rid of
> the origin branch. (I probably should have used the no-metdata switch).
>
> The command I used was
>
> git branch prune origin
>
> I tried "git remote rm origin" which worked on my local win32 machine,
> but the linux server I was working on did not recognise "git remote rm".
>
> I'm pretty sure git stores the current git directory as I've seen the
> --git-dir and --work-tree environment variables.

Git doesn't store them by default for the current repository. "git rev-parse --git-dir" guesses where your .git/ directory is (looking for ./.git/, ../.git, and so on). OTOH, Git stores URLs for remote repositories (see .git/config).

> Plus I also noticed on msysgit gives " Local uncommitted changes,
> not checked in to index" sometimes, when I move the directory.

I don't know msysgit, but I guess you'll have problems if your repository is on a FAT filesystem. Is it the case?

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Santi Béjar· Oct 16, 2009, 15:41 UTC · re: Richard Lee · lore

Re: Moving git

On Fri, Oct 16, 2009 at 4:58 PM, Richard Lee <richard@webdezign.co.uk> wrote:
> I cloned a git directory/repository? and then moved it.

So you moved the original repository. Then you have to update the url in the new/cloned repositories. I would edit .git/config and changed the url entries with the new value.

HTH, Santi

Richard Lee· Oct 16, 2009, 17:04 UTC · re: Richard Lee · lore

Re: Moving git

Hi all,

Thank you to Matthieu Moy and Santi Béjar who both told me to check .git/config.

The reason why I had problems was because I was using git config --get-all (with no regex). I then used git config -l and saw the remote local path to the repository that I used to clone.

The reason I had problem with git remote rm was because I was using version 1.5.2 as I installed it from yum. (This is what I hate about CentOS, all the repositories are old as dirt.) I compiled version 1.6.5 and the command was there. I think the ability probably was there in 1.5.2, but you probably had to do some extra magic stuff to completely remove the repository. And by trying to git remote prune didn't help either as I had deleted the local repository.

I now could "git remote rm origin" with no problems after moving the whole git directory.

Richard
-- 
View this message in context: http://www.nabble.com/Moving-git-tp25926819p25928820.html
Sent from the git mailing list archive at Nabble.com.
Matthieu Moy· Oct 16, 2009, 17:10 UTC · re: Richard Lee · lore

Re: Moving git

Richard Lee <richard@webdezign.co.uk> writes:
> The reason I had problem with git remote rm was because I was using version
> 1.5.2 as I installed it from yum. (This is what I hate about CentOS, all the
> repositories are old as dirt.) I compiled version 1.6.5 and the command was
> there.

It's a good idea to have a recent version of Git. The user-friendlyness of Git is progressing quickly, and each new version brings a myriad of little details that will make your life easier while learning Git ;-).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Todd Zullinger· Oct 16, 2009, 18:42 UTC · re: Richard Lee · lore

Re: Moving git

Richard Lee wrote:
> The reason I had problem with git remote rm was because I was using
> version 1.5.2 as I installed it from yum. (This is what I hate about
> CentOS, all the repositories are old as dirt.)

Not that it's much newer, but if you use the EPEL repository, 1.5.5.6 is available.

> I compiled version 1.6.5 and the command was there.

And if it helps, the Fedora package is intended to be able to build cleanly on CentOS as well -- though it depends on some macro settings available in the buildsys-macros package found at:

    http://buildsys.fedoraproject.org/buildgroups/rhel5/
...in the proper directory for your architecture.
-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Every time I close the door on reality, it comes in through the
windows.
rhlee· Oct 19, 2009, 09:30 UTC · re: Todd Zullinger · lore

Re: Moving git

Thanks, I've been looking for something like EPEL for a long time.
-- 
View this message in context: http://n2.nabble.com/Moving-git-tp3836198p3848039.html
Sent from the git mailing list archive at Nabble.com.
Daniel Barkalow· Oct 20, 2009, 16:33 UTC · re: Richard Lee · lore

Re: Moving git

On Tue, 20 Oct 2009, Richard Lee wrote:
Show 20 quoted lines
> 
> Hi Git forum,
> 
> I've just started using git yesterday, so I'm very new. So please excuse if
> I've done something the wrong way.
> 
> I cloned a git directory/repository? and then moved it. I'm trying to prune
> branches and it gives
> 
> ]fatal: '/var/www/vhosts/mydomain.co.uk/b2.git': unable to chdir or not a
> git archive
> fatal: The remote end hung up unexpectedly
> ls-remote --heads /var/www/vhosts/mydomain.co.uk/b2.git: command returned
> error: 1
> 
> b2.git was the cloned bare thing I create following the instruction here:
> 
> http://book.git-scm.com/4_setting_up_a_private_repository.html
> 
> Is there someway I can get git to update the git base directory?

The exact problem, I think, is that your clone has saved the original location of the bare repository as the default upstream repository location, and now it's not there. (It's a little hard to tell without the command that you were running when you got the error.)

If you edit the clone's .git/config, you should see the old location in a '[remote "origin"]' section. If you change this to the new location, everything should work. You can also do it with "git remote" somehow, but I personally just edit the config file, so I don't know the details.

	-Daniel
*This .sig left intentionally blank*
Richard· Oct 20, 2009, 16:37 UTC · re: Daniel Barkalow · lore

RE: Moving git

Thanks to anyone for the reply, but this issue has been resolved. I might have submitted this several times, but Nabble keeps on nagging me about multiple posts. So I'm just going to delete it.

-----Original Message-----
From: Daniel Barkalow [mailto:barkalow@iabervon.org] 
Sent: 20 October 2009 17:34
To: Richard
Cc: git@vger.kernel.org
Subject: Re: Moving git
On Tue, 20 Oct 2009, Richard Lee wrote:
> 
> Hi Git forum,
> 
> I've just started using git yesterday, so I'm very new. So please
excuse if
> I've done something the wrong way.
> 
> I cloned a git directory/repository? and then moved it. I'm trying to
prune
> branches and it gives
> 
> ]fatal: '/var/www/vhosts/mydomain.co.uk/b2.git': unable to chdir or
not a
> git archive
> fatal: The remote end hung up unexpectedly
> ls-remote --heads /var/www/vhosts/mydomain.co.uk/b2.git: command
returned
> error: 1
> 
> b2.git was the cloned bare thing I create following the instruction
here:
> 
> http://book.git-scm.com/4_setting_up_a_private_repository.html
> 
> Is there someway I can get git to update the git base directory?

The exact problem, I think, is that your clone has saved the original location of the bare repository as the default upstream repository location, and now it's not there. (It's a little hard to tell without the command that you were running when you got the error.)

If you edit the clone's .git/config, you should see the old location in a '[remote "origin"]' section. If you change this to the new location, everything should work. You can also do it with "git remote" somehow, but I personally just edit the config file, so I don't know the details.

	-Daniel
*This .sig left intentionally blank*

← back to recent threads