While trying to setup a synchronization for a bitbucket repo on my local server, I am getting the error not a git repo. Below is the command which I fired:
$ git --git-dir=~/gitRepo/my_repo.git remote add origin git@bitbucket.org:username/my_repo.git
fatal: Not a git repository: '~/gitRepo/my_repo.git'
Even I tried to init the repo (as previously I was not doing that) but still same error I got. Below are the steps which I followed after looking tutorials on Git (as I am new to Git so sorry if I ask very basic question)
$ git init
Initialized empty Git repository in ~/gitRepo/my_repo/.git/
$ git --git-dir=~/gitRepo/my_repo remote add origin git@bitbucket.org:username/my_repo.git
fatal: Not a git repository: '~/gitRepo/my_repo'
Is something I am missing. Basically I am trying to setup a sync of Redmine with BitBucket and this is one of the steps required.
If you didn’t initialize the repo when doing your first command, then the error message is normal: you need to create a repo before adding it any remote.
As for your second error message: If you are in the git repo directory itself (which you are after a
git init), then, as Issac comments, you don’t need a--git-dirparameter.But if you still want to add an
--git-dirargument, then the path referenced by a--git-dirfor a non-bare repo must ends in/.git(like you did in your first command).Even after creating a git repo in
~/gitRepo/my_repo:~/gitRepo/my_repois not a git repo~/gitRepo/my_repo/.gitis