How to convert a normal Git repository to a bare one?

后端 未结 17 1213
礼貌的吻别
礼貌的吻别 2020-11-22 08:05

How can I convert a \'normal\' Git repository to a bare one?

The main difference seems to be:

  • in the normal Git repository, you have a .git

17条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-22 08:17

    Please also consider to use

    git clone --mirror path_to_source_repository
    

    From the documentation:

    Set up a mirror of the source repository. This implies --bare. Compared to --bare, --mirror not only maps local branches of the source to local branches of the target, it maps all refs (including remote-tracking branches, notes etc.) and sets up a refspec configuration such that all these refs are overwritten by a git remote update in the target repository.

提交回复
热议问题