Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Cannot push new project

Jean Holland March 18, 2018

$ git push -u origin master
To https://bitbucket.org/t3chlady/bigcommerceapi.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://t3chlady@bitbucket.org/t3chlady/bigcommerceapi.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.

 

I've tried several times to resolve this problem but I dont know what is causing it.

The only file in the bitbucket repository is the Read.me (which does not exist locally)

Not sure how to resolve the two repositories.

3 answers

1 vote
Jean Holland March 18, 2018

I executed this command:

git branch --set-upstream-to=origin/master master

Then 

git pull

and got this error:

fatal: refusing to merge unrelated histories

0 votes
Jean Holland March 18, 2018

Thank you for your reply.

I tried the following:

git pull --all

Fetching origin

There is no tracking information for the current branch

Please specify which branch you want to merge with

Since I have only the master branch in both locations I am not sure how to structure the command

0 votes
Alexey Matveev
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.
March 18, 2018

You need to pull first the branch from the repository. If there will be no conflicts, then your local code will be merged with the remote code. After it you can push your version to the remote destination.

Alexey Matveev
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.
March 18, 2018

I am not sure what happened in your local git. But you can always clone repostitory to a new folder and then update required files from the current local folder.

Jean Holland March 20, 2018

Hello Alexey,

You always seem to provide simple and straightforward answers but I am new to bitbucket and git in general.  I don't know how to clone the repository.  Do I copy the files myself to a new space?  Does the clone command do that?  Can I use the respositories in bitbucket?  Do I have to create another new one.  I apologize but I'm not sure where to start.  Thanks for your help.

Jean

Alexey Matveev
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.
March 20, 2018

You do not have to create a new repository. You should.

1. Create a new folder on your local computer

2. clone your repository into the new folder with the git clone command

3. Move changed files from the previous folder to the new folder.

4. execute git add *

5. execute git commit -m "changes"

6. execute git push origin <your current branch in the local filesystem>

Jean Holland March 21, 2018

Hi Alexey,

I followed your instructions and on step 6, I got this error:

fatal 'c:VS2017ProjectsBigCommerceAPI doesnot appear to be a git repository

Fatal: could not read from remote repository.

When I used the clone command I put in a full path to the old folder.  Perhaps that is what the error is all about.

Alexey Matveev
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.
March 21, 2018

You need to clone in a new repository. And then copy changed files from the old repository to the new one.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events