Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What if Git finds out that git push origin master reported an error?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces what to do when Git finds that git push origin master reports an error. It is very detailed and has certain reference value. Friends who are interested must finish reading it.

The solution to git push origin master error report is shared with you as follows:

The error prompt is as follows

[root@linux1 php] # git push-u origin master To git@github.com:kangvcar/Results-Systems--PHP.git! [rejected] master-> master (fetch first) error: failed to push some refs to 'git@github.com:kangvcar/Results-Systems--PHP.git'hint: Updates were rejected because the remote contains work that you dohint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first merge the remote changes (e.g.hint:' git pull') before pushing again. Hint: See the 'Note about fast-forwards' in' git push-- help' for details.

Reason

The README.md file in the GitHub remote warehouse is not in the local warehouse.

Solution 1

We only need to add the-f parameter to make push successful.

[root@linux1 qimo] # git push-f warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to' simple'. To squelch this message and maintain the current behavior after the default changes, use: git config-- global push.default matching To squelch this message and adopt the new behavior now, use: git config-- global push.default simple See 'git help config' and search for' push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of' simple' if you sometimes use older versions of Git) Counting objects: 53, done. Compressing objects: 100% (53 amp 53), done. Writing objects: 100% (53 MiB), 1.35 MiB | 55.00 KiB/s, done. Total 53 (delta 8), reused 0 (delta 0) remote: Resolving deltas: 100% (8 8), done. To git@github.com:kangvcar/Results-Systems--PHP.git + fbe05e8...70b187d master-> master (forced update)

Solution 2

All we have to do is add the-- rebase parameter and push it again.

[root@linux1 qimo] # git pull-- rebase origin master [root@linux1 qimo] # git push-u origin master is all the content of this article "what to do if Git finds an error in git push origin master". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report