Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
1 view
in DevOps and Agile by (19.4k points)

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 folder inside the repository containing all relevant data and all other files build your working copy
  • In a bare Git repository, there is no working copy and the folder (let's call it repo.git) contains the actual repository data

1 Answer

0 votes
by (27.5k points)

These commands helped me solve the issue:

cd repo

mv .git ../repo.git # renaming just for clarity

cd ..

rm -fr repo

cd repo.git

git config --bool core.bare true

What are we doing here? Replace the contents of repo with the contents of repo/.git, then tell the repository that it is now a bare repository.

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.2k users

Browse Categories

...