1

Still learning git and trying to use it for daily work, in this respect, I have a repository on a Linux cluster where there is no backup(this works with an ssh protocol) and I would like to move it to another server where there are nightly backups, however, I am not successful up to this point(and this one works with https protocol).

What I did was to add the new remote location with

git remote add <name> https://server.info/directory.info

and I investigated that my new remotes are there with

git remote -v

then I tried to create an empty git repo on the server which I mounted with sshfs, however there I got the below messages with git init

error: could not commit config file
/home/utabak/webDataTU/staff-homes/t/utabak/vibroSys/.git/config
error: could not commit config file
/home/utabak/webDataTU/staff-homes/t/utabak/vibroSys/.git/config
error: could not commit config file
/home/utabak/webDataTU/staff-homes/t/utabak/vibroSys/.git/config
error: could not commit config file
/home/utabak/webDataTU/staff-homes/t/utabak/vibroSys/.git/config
error: could not commit config file
/home/utabak/webDataTU/staff-homes/t/utabak/vibroSys/.git/config
Initialized empty Git repository in
/home/utabak/webDataTU/staff-homes/t/utabak/vibroSys/.git/

Then I tried to push the local repository that I pulled from the original repo with

git push webDataTU master

and got

fatal: https://path.info/info/refs not found: did you run git
update-server-info on the server?

subsequently, I did on the server side

git update-server-info

And tried

git push webDataTU master

and got the same error again.

Where is my mistake?

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
Umut Tabak
  • 1,862
  • 4
  • 26
  • 41
  • It looks like the repository wasn't properly created at the `git init` stage. Can you try to re-initialize it directly on the server instead of over SSHFS? – ChrisGPT was on strike Jan 12 '14 at 17:06
  • well, how can I do that, more specifically, is there a way to do it with ssh or https? – Umut Tabak Jan 12 '14 at 17:07
  • 1
    SSH to the server, `cd` to the directory you want to hold your repositories, then `git init --bare repo-name.git`. – ChrisGPT was on strike Jan 12 '14 at 17:09
  • well ok, the pages are under https protocol not ssh... – Umut Tabak Jan 12 '14 at 17:14
  • Don't you have SSH access? You said you tried this before using SSHFS. – ChrisGPT was on strike Jan 12 '14 at 18:34
  • I did not say that, what I said, the other server is working on ssh protocol, but the new one uses https, so I have a local copy from the ssh server(which does not have backups) and I would like to set up the same on the https one... – Umut Tabak Jan 12 '14 at 19:06
  • I think I'm having trouble understanding the question, then. – ChrisGPT was on strike Jan 12 '14 at 19:15
  • ok, I am keeping my tracked version on a server where I set this one up with ssh access. Works fine but there is no backup, as far as I learned lately. I want to move this repository to another server which has backups, well it is not a server, but a home directory for staff which is backed up but the point is that it is not using ssh protocol but https – Umut Tabak Jan 12 '14 at 19:18
  • But you said you mounted it with sshfs! How is that even possible? – Robin Green Jan 12 '14 at 19:49
  • well, yes, indeed, I could mount with sshfs but the exact place can be reached from a web browser with https://webdata.tudelft.nl you have to enter your credentials. I am not good at these issues, trying to read still. – Umut Tabak Jan 12 '14 at 19:52

1 Answers1

1

Don't try to copy it or clone it: too many files to transfer, and you need to invoke Git from a remote server.

Make a simple bundle (git bundle):

cd /path/to/your/repo
git bundle create ../repo.bundle --all

Now you have only one file to transfer over your new server. This is a pure file operation (no Git involved).
And you can clone from that file, once it is copied in said new server:

cd /path/to/bundle
git clone repo.bundle
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • ok, thx, but this did not work since I get the error error: could not commit config file /home/utabak/webDataTU/staff-homes/t/utabak/vibroSys/.git/config fatal: 'origin' does not appear to be a git repository fatal: The remote end hung up unexpectedly – Umut Tabak Jan 17 '14 at 13:11
  • @UmutTabak what command did you type to get such an error message? Was it within your repo on your first server? – VonC Jan 17 '14 at 13:13
  • I bundled the repo as you explained above first, there were no problems. I copied the .bundle with ftp to my local hard drive and then I mounted the shared drive with sshfs user@sftp.tudelft.nl: /home/user/webDataTU/. After mouting this remote shared driver, I copied the bundle under this shared drive and I did 'git clone vibroSys.bundle' under the shared folder. Here is the complete message http://pastebin.com/raw.php?i=KM8jMx2M – Umut Tabak Jan 17 '14 at 13:18
  • @UmutTabak the git clone is supposed to be done directly on the destination server, in order to restore locally the repo. – VonC Jan 17 '14 at 13:29
  • ok but that is what I am doing I believe, I am creating the bundle where it is now. And transferring that bundle file to this shared and backed up drive and doing the git clone there. Am I mistaken? – Umut Tabak Jan 17 '14 at 13:31
  • @https://github.com/git/git/blob/14598b907008dc9952428662a30ecfd74dc90a79/config.c#L1682-L1685: that is strange, like your `.git/config` of the cloned repo was included in your bundle and was in use. The bundle shouldn't include a `.git/config`. – VonC Jan 17 '14 at 14:07
  • ok, then why is that bundled? is there something wrong on my original repo? – Umut Tabak Jan 17 '14 at 14:18
  • @UmutTabak before doing the clone on the destination server, can you check if you can clone that same bundle on the source server? (the one where you did a `git bundle`) – VonC Jan 17 '14 at 14:52