Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal: bad default revision 'HEAD'

Tags:

git

I'm using GIT as my source control system. We have it installed on one of our Linux boxes. Tortoise GIT is my windows client.

This morning I checked in some changes, and tagged the code. I then did a push of my local repository to the remote repository.

When I go to my repository on the unix box and type in git log I get:

fatal: bad default revision 'HEAD'

But when I do a show log using my windows tortoiseGit client the history comes up nicely as per below...

---
SHA-1: f879573ba3d8e62089b8c673257c928779f71692

Initial drop of code

---
master origin/master oms-phase4-v1.0.0
SHA-1: 56176dbe45e6175b18c9f44533828806c63142ab

OMS Phase 4 - Added OMS Cust. Order No. to EDI Purchase Order Header screens

Tag Info

object 56176dbe45e6175b18c9f44533828806c63142ab
type commit
tag oms-phase4-v1.0.0
tagger Richard Riviere <[email protected]> 1364338495 +1100

---
SHA-1: 0000000000000000000000000000000000000000

Working dir changes
0 files changed

---

The code has definitely been pushed to the remote repository. I've been able to check by cloning the repository into a different directory.

Does anyone know why I am receiving the fatal: bad default revision 'HEAD'?

p.s. It is a bare repository however I have created other bare repositories which have not had this problem.

like image 774
Richie Avatar asked Mar 26 '13 03:03

Richie


4 Answers

just do an initial commit and the error will go away:

git commit -m "initial commit"
like image 51
JRomio Avatar answered Nov 18 '22 23:11

JRomio


This happens to me when the branch I'm working in gets deleted from the repository, but the workspace I'm in is not updated. (We have a tool that lets you create multiple git "workspaces" from the same repository using simlinks.)

If git branch does not mark any branch as current, try doing

git reset --hard <<some branch>>

I tried a number of approaches until I worked this one out.

like image 39
Alice Purcell Avatar answered Nov 18 '22 23:11

Alice Purcell


Not committed yet?

It is a orphan branch if it has no commit.

like image 25
linquize Avatar answered Nov 18 '22 21:11

linquize


Your repo is yours, what goes on in it is entirely your business until you push or (allow a) fetch or clone. When you deleted your windows repo -- that folder didn't represent your local repo, it was your actual local repo, you deleted everything done in it that was never pushed, fetched or cloned.

edit: Ah, okay, I think I see what's going on here: you pushed to your linux repo but it's not bare and you never worked in it.

Instead of git log, do git log --all. Or git checkoutsome-branch-name.

Then try cloning the repo locally, on your linux box; I bet it works. What are you using to serve your repo on linux? Try cd'ing into its .git directory and git daemon --base-path=. --export-all, if that just sits there then go to your windows box and try git clone git://your.linux.box.ip, if the daemon complains it can't bind add --port=54345 to the daemon invoke and :54345 to the clone url.

like image 18
jthill Avatar answered Nov 18 '22 21:11

jthill