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

How to deal with the mistake of using git push Times

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "how to deal with mistakes in using git push Times". Friends who are interested might as well take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to deal with mistakes in using the git push Times".

Error 1: [root@361way shell] # git pushwarning: push.default is unset; its implicit value is changing inGit 2.0 from 'matching' to' simple'. To squelch this messageand maintain the current behavior after the default changes, use:git config-- global push.default matchingTo squelch this messageand adopt the new behavior now, use:git config-- global push.default simpleSee '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)

After putting the "dog" query, you know that the 'matching' parameter is the default behavior of Git 1.x, which means that if you execute git push but do not specify a branch, it will push all your local branches to the corresponding matching branch in the remote repository. Git 2.x defaults to simple, which means that when the execution git push does not specify a branch, only the current branch will be push to the code you get using git pull. Type the following command:

[root@361way shell] # git config-- global push.default matching error 2: [root@361way shell] # git push-u origin masterTo https://361way:mypassword@github.com/361way/shell.git! [rejected] master-> master (fetch first) error: failed to push some refs to 'https://361way:mypassword@github.com/361way/shell.git'hint: Updates were rejected because the remote contains work that you dohint: not have locally. This is usually caused by another repository pushinghint: to the same ref. You may want to first merge the remote changes before pushing again.hint: See the' Note about fast-forwards' in 'git push-- help' for details.

Push again, found that there is another error, according to the error content, the general understanding is that the local and remote content may be inconsistent, it is recommended to git pull a copy, and then push to romte. Since some modifications are usually modified on Ali cloud servers that are too lazy to push to remote synchronization, local and remote inconsistencies are also possible. Now that it is inconsistent, take the one saved on Aliyun as the standard, and force synchronization.

[root@361way shell] # git push-u origin master-force

Forced synchronization, found that you can normally synchronize the content to the github, and then add files for synchronization, found that there is no error.

At this point, I believe you have a deeper understanding of "how to deal with mistakes in the use of git push Times". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Development

Wechat

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

12
Report