Skip to contentSkip to conversation

Moving git

DISCUSSION Richard Lee 5 participants 11 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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

Signature · 2 lines
View this message in context: http://www.nabble.com/Moving-git-tp25926819p25926819.html
Sent from the git mailing list archive at Nabble.com.
#1 lore raw

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

Signature · 2 lines
View this message in context: http://www.nabble.com/Moving-git-tp25926819p25928820.html
Sent from the git mailing list archive at Nabble.com.
#2 lore raw
Quoted 3 lines · Richard Lee

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.

Quoted 1 line

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.

Signature · 4 lines
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Every time I close the door on reality, it comes in through the
windows.
author
#3 lore raw

Thanks, I've been looking for something like EPEL for a long time.

Signature · 2 lines
View this message in context: http://n2.nabble.com/Moving-git-tp3836198p3848039.html
Sent from the git mailing list archive at Nabble.com.
#4 lore raw
In reply to Richard Lee
Quoted 4 lines · Richard Lee

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 ;-).

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/
#5 lore raw
In reply to Richard Lee
Quoted 1 line · Richard Lee

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

#6 lore raw
In reply to Richard Lee
Quoted 7 lines · Richard Lee

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?

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/
author
#7 lore raw

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:[email protected]]
Sent: 16 October 2009 16:17
To: Richard
Cc: [email protected]
Subject: Re: Moving git

Quoted 3 lines · Richard Lee

Hi Git forum,

I've just started using git yesterday, so I'm very new. So please

excuse if

Quoted 3 lines

I've done something the wrong way.

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

prune

Quoted 1 line

branches and it gives

Which command did you type?

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/
#8 lore raw
Quoted 10 lines · Richard

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

Quoted 7 lines

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).

Quoted 2 lines

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?

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/
#9 lore raw
In reply to Richard Lee
Quoted 15 lines · Richard Lee

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

Quoted 5 lines

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*

author
#10 lore raw

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:[email protected]]
Sent: 20 October 2009 17:34
To: Richard
Cc: [email protected]
Subject: Re: Moving git

Quoted 4 lines · Richard Lee

Hi Git forum,

I've just started using git yesterday, so I'm very new. So please

excuse if

Quoted 3 lines

I've done something the wrong way.

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

prune

Quoted 3 lines

branches and it gives

]fatal: '/var/www/vhosts/mydomain.co.uk/b2.git': unable to chdir or

not a

Quoted 3 lines

git archive
fatal: The remote end hung up unexpectedly
ls-remote --heads /var/www/vhosts/mydomain.co.uk/b2.git: command

returned

Quoted 3 lines

error: 1

b2.git was the cloned bare thing I create following the instruction

here:

Quoted 4 lines

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*