Note: This article was originally published in 2014. Some steps, commands, or software versions may have changed. Check the current BitBucket documentation for the latest information.
If you’re encountering this issue, this troubleshooting guide will help you identify the root cause and apply the appropriate fix.
Resolved: fatal: Not a git repository (or any of the parent directories): .git
I just started using (http://bitbucket.org/ “BitBucket”) as it offer private Git repositories which is something I was looking for and (http://github.com “GitHub”) obviously charges for that. I am going to use my repository for something small and simple not a huge project so justifying the monthly fee was rather hard. Anyway, the instructions for adding a repository in BitBucket read like so:
cd /path/to/my/repo git remote add origin https://[email protected]/UserName/Project-Name.git git push -u origin —all # pushes up the repo and its refs for the first time git push -u origin —tags # pushes up any tags
However, when running the first instruction I am stuck with “fatal: Not a git repository (or any of the parent directories): .git”. The answer though was simple, I needed to initialize my local repository with an empty Git Repository. Simply execute git init and you’ll get this message: Initialized empty Git repository in /etc/somefolder/.git/ Now run your remote add origin command again and you’re done!
(http://img.zemanta.com/zemified_h.png?x-id=069dab44-b41f-4a4e-8d71-bb3d5e4a4b27)](http://www.zemanta.com/?px “Enhanced by Zemanta”)
Summary
This guide covered the common causes and solutions for this BitBucket issue. If the problem persists, check the official documentation or system logs for additional diagnostic information.