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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,467,198
Community Members
 
Community Events
177
Community Groups

I typed git push -u origin master and got an error saying rejected. How do I fix it?

Hi,

I typed git remote add origin.... (and my https to the repository)

Then I typed git push -u origin master

I got an error saying rejected. I attach the snapshot.

How can I fix this? 

Thank you.

Best regards,

Veronicanew-error-cannot-push-to-my-repo.jpg

1 answer

1 accepted

1 vote
Answer accepted
Vishwas Rising Star Jan 20, 2022

Hey @Veronica Chiaravalli 

Welcome to Atlassian Community !!

From the error i could see that the remote changes are way forward(means there are already changes pushed to remote and your local is outdated). To fix this you can take a git fetch from remote and then push the code.

Regards,

Vishwas

Hi Vishwas,

Thank you. 

How do I do that? I am a beginner.

Regards,

Veronica

Vishwas Rising Star Jan 20, 2022

Hey 

Not a problem,  I will guide you.

My guess you are doing commands to do git operations ?

just run this command:

git fetch

and then

git push -u origin master

 

Let me know in case of any issues.

 

Regards,

Vishwas

Like Veronica Chiaravalli likes this

Hi, 

I did it and I still got an error.

After the git fetch it gave some info.

Then I did the git push -u origin master and got this:

last-error-message-after-git-fetch-and-git-push.jpg

Hi,

I am still stuck and unable to push the files to my repo.

The only difference is that the error message changed.

Could you please help me?

 

Thank you very much.

Kind regards,

Veronica Chiaravalli

Vishwas Rising Star Jan 21, 2022

Hey,

I guess this is not allowing with just a fetch command we have to run git pull and then run git push.

As mentioned in this article https://stackoverflow.com/questions/57664991/bitbucket-error-failed-to-push-some-refs#:~:text=This%20is%20usually%20caused%20by,push%20%2D%2Dhelp'%20for%20details.

You may have to run this command:

git pull origin master --allow-unrelated-histories

Please check this out, let me know any issues.

Regards,

Vishwas

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events