I have created an empty Git repository in Atlassian Stash and cloned it.
$ git clone http://me@myrepo/my/repo.git
...
warning: You appear to have cloned an empty repository.
Then I've created some files, added them via git add
and wanted to commit via git commit
. I get the following error:
ERROR: Unable to determine active branch in current context !
ERROR: GITLib::Branch::get_current died at line 41
When I do git rev-parse HEAD
I get:
$ git rev-parse HEAD
HEAD
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
When I issue git branch -a
to see if there are any remote branches, the output is empty.
Let's create a branch locally:
$ git checkout -b "foo"
Switched to a new branch 'foo'
$ git commit -m "test"
ERROR: Unable to determine active branch in current context !
ERROR: GITLib::Branch::get_current died at line 41
How do I get my repo in a workable state?
I tried issuing git commit --allow-empty
, git init
but it didn't change anything.
Edit:
When I just create an empty repo locally with git init
, then git add
and try to git commit
similar happens:
ERROR: GIT::Command::git_or_die died at line 164
Edit 2:
It seems an internal issue due to a hook in my company. I'll follow up with details if this gets resolved.
Using Git Bash 1.8.5.2 @ Win7.
Rather than cloning the empty repository from Stash, try creating a new repository locally (in a new directory) with:
git init .
Add your files and make your first commit. The freshly init'd repository should have a proper HEAD
and master
branch:
git add file1.txt
git add file2.txt
git commit
Then, add your empty Stash repo as a remote and push master there:
git remote add origin http://me@myrepo/my/repo.git
git push -u origin master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With