Shunya
Shunya

Reputation: 2913

Warning on converting a non-bare repo to bare repo: "appear to have cloned an empty repository"

I am converting my existing non-bare repo to bare repo using the following command:

git clone --bare -l non_bare_repo new_bare_repo

However, I get a warning saying

You appear to have cloned an empty repository

Why this is happening, any idea?

Upvotes: 2

Views: 267

Answers (2)

GreenAsJade
GreenAsJade

Reputation: 14685

This warning happens when you clone an empty repository: a repository with no commits.

It is only a warning, of course: that means the outcome might be OK for you.

Git warns you about this, because generally you would be cloning a repo to get and work on its content. So it seems like it might be a mistake - something to warn you about - that you are cloning an empty repo.

Note that when you clone a repo with no commits, you do not get any working files that were in the source repo.

So in your case, the working files in your non-bare repo would not have been copied over to the bare repo (obviously, because bare repos can't have working files).

This means that a possibly-more logical way of doing what you did was

  git init --bare new-bare-repo

Doing it this way avoids implying that you achieved anything other than making an empty bare repo.

Upvotes: 0

Sergey K.
Sergey K.

Reputation: 25386

Go to the hidden .git folder and edit config file:

[core]
    bare = true

Then remove any local copy files and you will have the bare repository.

Upvotes: 1

Related Questions