Sửa lỗi failed to get remote patch info
(The following assumes
Show 1 itself is not down, as eri0o points out in : see
2 to be sure) If the GitHub repo has seen new commits pushed to it, while you were working locally, I would advise using:
The full syntax is:
With Git 2.6+ (Sept. 2015), after having done (once)
A simple
3 would be enough. (Note: with Git 2.27 Q2 2020, a
4 is also available for your regular pull, without rebase) That way, you would replay (the
5 part) your local commits on top of the newly updated
6 (or
7:
8). See a more complete example in the of the Git Pocket Book. I would recommend a:
That would establish a tracking relationship between your local main branch and its upstream branch. After that, any future push for that branch can be done with a simple:
Again, with Git 2.37+ and its global option
9, a simple
0 even for the first one would do the same (I.e: establishing a tracking relationship between your local
6). See "Why do I need to explicitly push a new branch?". Since the OP already reset and redone its commit on top of
6:
There is no need to
4. Note:
5 can also be written
6, since the
7 option is the default one when using
8. This error mainly occurs when you attempt to push your local changes to GitHub while the local repository (repo) has not yet been updated with any changes made in the remote repo. So Git is trying to tell you to update the local repo with the current changes in the remote before pushing your own changes. This is necessary so that you don't override the changes made by others. We'll be discussing two possible ways of fixing this error in the sections that follow. We can fix the Let's go over how you can use the commands above. How to Fix error: failed to push some refs to Error in Git Using git pullTo send a pull request means to "fetch" new changes made to the remote repo and merge them with the local repo. Once the merging is done, you can then push your own code changes to GitHub. In our case, we're trying to get rid of the Here's how you can do that:
If you're working with a different branch, then you'd have to replace
0 in the example above with the name of your branch. Just keep in mind that there are chances of failure when using this command to sync your remote and local repos to get rid of the error. If the request succeeds, then go on and run the command below to push your own changes:
If the error persists, you'll get an error that says:
1. In that case, use the solution in the next section. How to Fix error: failed to push some refs to Error in Git Using
3 The
3 command is helpful in situations where your local branch is a commit behind the remote branch. To fix the error, go on and run following commands:
If the first command above runs successfully, you should get a response that says:
5. The second command pushes your local repo's current state to the remote branch. SummaryIn this article, we talked about the This error occurs when you attempt to push your local changes to the remote repo without updating your local repo with new changes made to the remote repo. We discussed two commands that you can use to fix the error: the I hope this helps you fix the error. Happy coding! Learn to code for free. freeCodeCamp's open source curriculum has helped more than 40,000 people get jobs as developers. Get started |