0

I greated a repository with: git init --bare on a server and I want to push a branch to it.

git push origin Dev

But I get

remote fatal: you are a branch waiting to be born.

What am I doing wrong?
It seems to work if I dont use --bare, but I think thats what I should be using.

EDIT: I am only getting this is error if I have a post-recieve hook on the server. I have this in my post-recieve hook:

#!/bin/sh
GIT_WORK_TREE=/var/www/UML git checkout -f

what I want this all to do is update the webserver when I push to the remote

And my git config:

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
[gui]
    wmstate = normal
    geometry = 887x427+25+25 330 192
[branch "master"]
[branch "Dev"]
[remote "origin"]
    url = ssh://mike628@192.168.2.2/GR
    fetch = +refs/heads/*:refs/remotes/origin/*
simont
  • 68,704
  • 18
  • 117
  • 136
mike628
  • 45,873
  • 18
  • 40
  • 57

1 Answers1

0

have you cloned the remote (bare) repository first or set the remote origin properly? does a branch with the name Dev exist and have commits? make sure to have at least one commit on that branch.


in your hook try git reset --hard instead of git checkout -f. also try adding exit 0; at the end (although that will just hide the exit code of the statement before). something in your hook is failing. is the executable bit set on your hook script? what happens if you execute the hook script directly on the server without git intervention?

also make sure your git process has write permissions in your /var/www/UML directory, as the script is executed by the user/group who runs git daemon

knittl
  • 246,190
  • 53
  • 318
  • 364