0

In the home dir, I create a bare git repo

git init --bare repo.git

and a regular repo mkdir dir1 cd dir1 git init touch file1 git add file1 git commit and everything works fine.

And also when I run the same commands with git -C dir1 from the home dir. So all is good and well, right?

Also, when I am inside of 'dir1', I can clone --mirror it into the bare repo cd dir1 git clone --mirror ../repo1.git

The problem:

From the home dir, I want to clone --mirror dir1 cd ~ git -C dir1 clone --mirror repo1.git

get an error: fatal: 'repo.git/' does not appear to be a git repository fatal: Could not read from remote repository.

How could I do this?

P.S.

I looked at discussions such as: fatal: does not appear to be a git repository and fatal: Not a git repository: '.' but they do not resolve the issue.

Benben
  • 611
  • 5
  • 5

1 Answers1

1

According to git

-C path

Run as if git was started in path instead of the current working directory.

That means, you need to specified, that your bare repository repo1.git is in the parent directory. So just run: git -C dir1 clone --mirror ../repo1.git

kadewu
  • 336
  • 4
  • 8