0

I need to create bare repository with package-refs files. Command git init --bare create bare repository without pack-refs files. What I have to do?

Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156
devil15
  • 19
  • 1
    If you mean `.git/packed-refs`: (1) why do you care? (2) a packed refs file will only exist when there are some references to pack; a new empty repository has no objects and hence no references to those nonexistent objects. – torek Aug 03 '19 at 20:41
  • (1) I need them (2) So how I create this references? – devil15 Aug 03 '19 at 20:56
  • What do you need them for? – mkrieger1 Aug 03 '19 at 21:08
  • References are a general term for things like branch names, tag names, remote-tracking names, `refs/replace` items, and so on. For those to exist, you must have some objects—usually, commits with files—in your repository. – torek Aug 03 '19 at 22:08
  • I would rephrase the question: "How to prepare an fresh repo so a subsequent fetch will store refs directly as a packed-refs file, skipping the intermediate step of creating thousands of ref files and then `git pack-refs --all` ?" Or: "How to select packed-refs as the default backend ref store for a repo?" – Jaredo Mills Jul 30 '22 at 01:07

1 Answers1

0

packed-refs files would only happen once:

  • you have added some files and make some commits
  • a git gc is done (which calls git repack)

An initial empty (bare or not) repository would therefore understandably do not have any packed files.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I believe the question seeks to create a repo where all refs are stored in packed format, without the need to `git gc`. An empty repo into which a large code base is fetched for the first time could end up with thousands of files in refs/, and there is a need for them to be stored in packed format from the beginning. – Jaredo Mills Jul 30 '22 at 01:04
  • @JaredoMills I agree, and I don't know if this is directly possible though. – VonC Jul 30 '22 at 20:15