This is my first time using Bitbucket. I tried to upload my project folders so I can share with my friends. However, every time I push the folder, I get the following message.
! [rejected] master -> master (fetch first)
error: failed to push some refs to "https://......"
hint: Updates were rejected because the remote contains work that you do not have locally. This is usually caused by another repository pushing to the same ref. You may want to first integrate the remote changes (e.g., 'git pull ...') before pushing again. See the "Note about fast-forwards" in the "git push --help" for details.
Thanks Steven,
I deleted the repos and restart again.
Do I have to stage and commit all the files in the local directory before pushing to the remote depos?
Yes, you can only push Commits -- With that in mind, you always need to stage files (git add path/to/file.txt) and commit files (git commit) before you push.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Strangely enough, I just follow the step when I first create the deposit. I did not add or commit, but push directly and it worked?!?!
Step 1: Switch to your repository's directory
cd /path/to/your/repo
Step 2: Connect your existing repository to Bitbucket
git remote add origin https://HungDuLuong@bitbucket.org/HungDuLuong/testing.git
git push -u origin master
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What the error is telling you is correct.
The repo you're pushing to has work that is not within your local copy of the repo. Thus, you'll need to pull down the latest changes to sync up, THEN you can push.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.