While moving repository around in Bitbucket, previous git branch was renamed. I had a local repository tracking the old Bitbucket repo. When I tried pushing some changes to the remote branch, it failed with:
fatal: ‘<oldbranch>/<oldbranch>’ does not appear to be a git repository
fatal: Could not read from remote repository.
After doing some web search, I found the following command:
>> git remote rm origin
This command removes the remote branch information from the local repo. There is a complementary command to add a new remote to the local repo:
>> git remote add origin git@bitbucket.org:<newbranch>/<newbranch>.git
You can get the url to the new branch by clicking on the ‘clone’ button. After setting the new remote, I was again able to commit changes to my bitbucket repository.
This article contains treasure trove of information about how to work with git remotes. I strongly recommend this for anyone working with git.