Forums

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

Getting error pushing file to repository

Priya Gopal May 8, 2019

I am trying to push a file from my local repo to remote. I did the following steps

image.png

 

image.png

 

I got the above fatal error. I am not able to push the file. Please help. I am pretty new to bitbucket.

 

Thanks,

priya

1 answer

0 votes
Mikael Sandberg
Community Champion
May 8, 2019

Hi Priya,

Welcome to the Atlassian Community.

The images you included are not showing, so without seeing the error it makes it a bit hard to help.

Priya Gopal May 8, 2019

Hi Mikael,

 

Not sure why the images are not showing up. I did clone and got the url . Then in windows CMD, in the local repo area, I did git clone and pasted the URL. It looks like it did the cloning part.

Then I did git add file name

git commit -m "initial commit message..."

I saw a message after the commit as "on branch master"

then when I did git push origin master

I got a message "fatal: origin does not appear to be a git repository"

"fatal: could not read from remote repository"

"please make sure have the correct access rights and the repository exists."

 

These were the error messages I got when I tried to push the file. Not sure, what I am doing wrong.

 

Thanks,

priya

Mikael Sandberg
Community Champion
May 8, 2019

Hi Priya,

Is your local repo area already a git repository or is it just a folder where you want to put your repository?

You can check that the remote is set correctly by running git remote -v, this will list the remote URLs:

$ git remote -v
Bitbucket.org https://username@bitbucket.org/username/repository.git (fetch)
Bitbucket.org https://username@bitbucket.org/username/repository.git (push)
Priya Gopal May 9, 2019

Hi,

I updated my source as my remote repo using the git set-url command. I tried to push the new file to repo. I get the following error message.

I am new to bitbucket. I am not lost on what I am doing wrong. I don't know how to set my master to my local repo which is my h drive in my machine.

 

git push source master
To https://bitbucket.cdisc.org/scm/oat/odm-test-src.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://priagopal@bitbucket.cdisc.org/scm/oat/odm-test-src.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.

Mikael Sandberg
Community Champion
May 9, 2019

Okay, in order to resolve this error you have to do a git pull, that will update the local master to be on the same commit as your remote master, plus any local changes you have.

Your other option if you do not want any of the changes on your remote master would be to run the git push with the --force option. Just be careful when using --force, since this will bypass the check to see that your local branch is not behind the remote branch, and can cause the remote repository to lose commits.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events