Questions tagged [git-bare]

A bare git repository is so named because it has no working directory; it only contains files that are normally hidden away in the .git subdirectory. In other words, it maintains the history of a project, and never holds a snapshot of any given version.

From Git Magic, Chapter 3:

A bare repository is so named because it has no working directory; it only contains files that are normally hidden away in the .git subdirectory. In other words, it maintains the history of a project, and never holds a snapshot of any given version.

A bare repository plays a role similar to that of the main server in a centralized version control system: the home of your project. Developers clone your project from it, and push the latest official changes to it. Typically it resides on a server that does little else but disseminate data. Development occurs in the clones, so the home repository can do without a working directory.

Converting:

197 questions
680
votes
18 answers

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

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 making up your working copy in a…
Boldewyn
  • 81,211
  • 44
  • 156
  • 212
374
votes
10 answers

How do you use "git --bare init" repository?

I need to create a central Git repository but I'm a little confused... I have created a bare repository (in my git server, machine 2) with: $ mkdir test_repo $ git --bare init Now I need to push files from my local repository (machine 1) to the…
André
  • 24,706
  • 43
  • 121
  • 178
274
votes
11 answers

What's the -practical- difference between a Bare and non-Bare repository?

I've been reading about the bare and non-bare / default repositories in Git. I haven't been able to understand quite well (theoretically) the differences between them, and why I should "push" to a bare repository. Here's the deal: Currently, I'm the…
AeroCross
  • 3,969
  • 3
  • 23
  • 30
117
votes
7 answers

Writing a git post-receive hook to deal with a specific branch

Here's my current hook in a bare repo that lives in the company's server: git push origin master This hooks pushes to Assembla. What i need is to push only one branch (master, ideally) when someone pushes changes to that branch on our server, and…
Jorge Guberte
  • 10,464
  • 8
  • 37
  • 56
99
votes
4 answers

How can I uncommit the last commit in a git bare repository?

Taking into consideration that there are several git commands that make no sense in a bare repository (because bare repositories don't use indexes and do not have a working directory), git reset --hard HEAD^ is not a solution to uncommit the last…
94
votes
9 answers

How do I convert a bare git repository into a normal one (in-place)?

I have a bare git repository, but need to access and browse its contents over ssh (in a file manager like user experience). I assume I could clone it: git clone -l However, my repository is about 20GB in size…
nyi
  • 1,425
  • 1
  • 15
  • 17
68
votes
4 answers

How do I create a master branch in a bare Git repository?

git init --bare test-repo.git cd test-repo.git (Folder is created with git-ish files and folders inside) git status fatal: This operation must be run in a work tree (Okay, so I can't use git status with a bare repo; makes sense I guess) git…
David
  • 15,750
  • 22
  • 90
  • 150
50
votes
8 answers

Getting a working copy of a bare repository

I have a server on which I have a bare repository for pushing. However, my server needs to have a working copy of the master branch. How do I get a working copy and that only from a bare repository?
Jonathan Allard
  • 18,429
  • 11
  • 54
  • 75
46
votes
1 answer

git ls-files in bare repository

I want to access a bare git repository, and I want to list all files in the repository. On a normal git repository I can easily do that by running git ls-files. Example output: $ git…
Jesper Rønn-Jensen
  • 106,591
  • 44
  • 118
  • 155
32
votes
4 answers

Git, How to change a bare to a shared repo?

So this is how I set up my project: git init --bare Later I learned that if you want to work on a project with multiple users this is how I should have done it: git init --bare --shared Now I tried to work like that and luckily we are in the…
bottleboot
  • 1,659
  • 2
  • 25
  • 41
31
votes
6 answers

How can I use git-archive to include submodules from a bare repository

I'm in the process of setting up a deployment script. The basic process is: Push changes to a bare repository on the server Then based on new tags will create a new folder for the release. Use git archive to move the files into the release…
Jacob
  • 8,278
  • 1
  • 23
  • 29
30
votes
2 answers

What is a bare repository and why would I need one?

This maybe has been answered, but I didn't find a good answer. I come from centralized repositories, such as SVN, where usually you only perform checkouts, updates, commits, reverts, merges and not much more. Git is driving me crazy. There are tons…
Albert
  • 1,156
  • 1
  • 15
  • 27
29
votes
3 answers

When creating a git repository that will be on the server, can I convert it to a bare repository?

I already created a repository. Can I make it a bare type or shall I start over?
mrblah
  • 99,669
  • 140
  • 310
  • 420
26
votes
3 answers

Git submodule on remote bare

I've setup my environment so I can push to a remote bare repository. I used these commands to set up the remote repository: $ mkdir ~/website.git && cd ~/website.git $ git init --bare And $ cat >…
Thiago Belem
  • 7,732
  • 5
  • 43
  • 64
22
votes
5 answers

can't clone git repos via http; info/refs not found

I am trying to make a git repository available for read-only access over http. I am doing it the old-style way because git-http-backend is not available on my host system. That is, I am simply putting the bare repository in a http accessible…
brainchild
  • 754
  • 1
  • 7
  • 21
1
2 3
13 14