I am trying to use a program that uses git as the backing store (I am new to git). On initialization, this program does a:
"git" "--bare" "rev-parse" "refs/heads/index"
Which results in:
fatal: Not a git repository: '/home/david/blog.git'
I followed this tutorial, git init
, git add test.txt
and git commit
. The repo seems to behave properly when (in the correct directory) I do (for example):
$ git status
What is rev-parse
doing and what do I have to do to my repo to make it work?
The “not a git repository” error is common. The cause is running a Git command in the wrong folder or running a Git command before initializing a Git repository. Now you're ready to solve the “not a git repository” error like an expert developer!
Check that you correctly created the repo. If the directory doesn't contain a . git repo, use git init to properly initialize the repo or clone an existing repo. Make sure your HEAD file contains the correct information on your current branch.
For the second situation, you need to initialize the Git repository in your project folder. To do so, you need to navigate to the correct folder and then run the command git init , which will create a new empty Git repository or reinitialize an existing one.
A Git repository tracks and saves the history of all changes made to the files in a Git project. It saves this data in a directory called . git , also known as the repository folder. Git uses a version control system to track all changes made to the project and save them in the repository.
If git status
is working then you must be in a non-bare repository with a working tree. git status
requires a working tree.
If the program is running git --bare ...
then it expects the given directory to be a bare git repository, i.e. with not working directory.
The naming convention of reponame.git
is usually reserved for bare repositores and non-bare repositories usually use a directory name of reponame
and contain a .git
subdirectory.
If /home/david/blog.git
is actually a non-bare repository then it will have a .git
subdirectory. If this is the case you can probably point the program at /home/david/blog.git/.git
but I can't help feeling that it would be safer to point it at a truly bare repository. What program is it and what were the instructions for initializing its data store?
`
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