On the official Bitbucket website we can read:
Locally, change to the root directory of your existing source.
Initialize the project by running the following commands in the terminal:git init
git add --all git commit -m "Initial Commit"
Log into Bitbucket Server and create a new repository.
Locate the clone URL in the nav panel on the left (for example: https://username@your.bitbucket.domain:7999 /yourproject/repo.git).
Push your files to the repository by running the following commands in the terminal (change the URL accordingly):git remote add origin https://username@your.bitbucket.domain:7999/yourproject/repo.git
git push -u origin master Done! Your repository is now available in Bitbucket Server.
and after this commands I got:
To https://bitbucket.org/myrepo/myapp.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://myrepo@bitbucket.org/myrepo/myapp.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
so now I'm try fetch
git fetch origin
and again
git push -u origin master
and I got
> To https://bitbucket.org/myrepo/myapp.git
> ! [rejected] master -> master (non-fast-forward) error: failed
> to push some refs to 'https://myrepo@bitbucket.org/myrepo/myapp.git'
> hint: Updates were rejected because the tip of your current branch is
> behind hint: its remote counterpart. Integrate the remote changes
> (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note
> about fast-forwards' in 'git push --help' for details.
Somebody can help me ? I waste too many days for this git