Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do you upload a project folder which contain multiple (different types) files?

hung luong May 10, 2018

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.

 

2 answers

0 votes
hung luong May 11, 2018

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?

Steven Behnke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 11, 2018

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.

hung luong May 17, 2018

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?!?!

Push your local repository to Bitbucket

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
0 votes
Steven Behnke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 10, 2018

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events