Skip to content

Clarifying reinitialization of a bare repo #1156

@josh-byster

Description

@josh-byster

First, I just wanted to say thank you for the great reference this has been for me. I really appreciate it.

I was reading 4.2 about how to set up git on a server.

Git will automatically add group write permissions to a repository properly if you run the git init command with the --shared option.

$ ssh [email protected]
$ cd /srv/git/my_project.git
$ git init --bare --shared

You see how easy it is to take a Git repository, create a bare version, and place it on a server to which you and your collaborators have SSH access. Now you’re ready to collaborate on the same project.

I had to do some research after reading this as I thought, "wait, wouldn't that be overwriting what we just cloned (my_project.git)?" Then I discovered there's the concept of reinitializing an existing repo. From my understanding (and please do correct me if this is incorrect), by running git init --bare --shared, we're reinitializing the bare repo to be shared, which doesn't actually overwrite anything but rather just changes some permissions and changes the core.sharedRepository config. If this is indeed the correct process, what do you think about maybe having a line or two of clarification as to what is happening here? I think it may clear up some confusion to emphasize the reinitialization rather than overwriting for people like me who are new to bare repos. I'm happy to open a PR if you believe this is something worth adding.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions