Creating a new BitBucket repo from a local directory
This documents how you can create a new repo in bitbucket from a local linux directory that is not under Git source control yet.
Create the empty repo in BitBucket
- Log in to bitbucket via web
- add a new, empty repository within some project using the following settings
- no README
- no .gitignore
- add a new, empty repository within some project using the following settings
-
Copy the url shown in the section Lets put some bits in your bucket (NOT THE CLONE CMD). Its shown in the section "Get Your Local Git repository". In my case, since I'm setting up the qmonitor repo it shows:
git remote add origin https://rschramm@bitbucket.org/mbari/qmonitor.git -
Copy that to your clipboard
- cd to your local project directory - mine was on pismo at /ssds/qmonitor
- create some minimal README.md file
-
create some minimal .gitignore file (mine just ignores the local logs sub-directory)
log/* *.pyc -
Then follow the instructions at BitBucket
git init git add . git commit -m "initial commit of full repository" git remote add origin https://rschramm@bitbucket.org/mbari/qmonitor.git git push -u origin --all Counting objects: 15, done. Delta compression using up to 2 threads. Compressing objects: 100% (12/12), done. Writing objects: 100% (15/15), 10.88 KiB | 0 bytes/s, done. Total 15 (delta 1), reused 0 (delta 0) To https://rschramm@bitbucket.org/mbari/qmonitor.git * [new branch] master -> master Branch master set up to track remote branch master from origin. -
And do this, because later pushes will tell you to (see 'NOTE_1' below for explanation)
git config --global push.default simple -
And as a last check:
git status # On branch master nothing to commit, working directory clean
NOTE_1
Later on, after modifying files and doing a git commit and push I got the following message
git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
So I did as I was told and ran
git config --global push.default simple
then my git push worked with no issues.