Resolved: fatal: Not a git repository (or any of the parent directories): .git

Resolved: fatal: Not a git repository (or any of the parent directories): .git

I just started using BitBucket as it offer private Git repositories which is something I was looking for and 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!

Enhanced by Zemanta

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.