Is anyone who is good at git online right now?

Looks like running git init --bare -b main on the server does what I need it to do

But can someone explain to me what is a bare repository, and why does everything break if I create a non-bare repository on the server instead? :psyduck:

Follow

@vaporeon_ a normally created git repository is a directory with a .git subdirectory, the ultimate source of truth about the repository and its history. the actual files that you are working on are part of the “working directory”

actually pushing to a remote only changes the contents of the .git subdirectory; the parent directory (that is, the “working directory”) is not changed to reflect any updates. strictly speaking this is fine, but consider a situation where

  1. somebody clones the repository,
  2. they add a new file and commit it, and
  3. they push the new commit back to upstream.

since the behavior of the the push opurration will not update the working directory upstream at all, this will create a very unintuitive situation where the history is being stored correctly, but the working directory is not updated. if you can git status in the remote, it would say the new file has been deleted! (although the change is recorded in .git, the working directory no longer has the file, so this is the conclusion git will come to about the current (unstaged) state of the working directory)

creating “--bare” repository makes the created directory just the .git subdirectory; no working directory is created at all. because git only needs the .git directory to handle server operations, this is fine

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.