Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual studio 2019 "Error encountered while pushing to the remote repository: Failed to push to the remote repository..."

In Visual Studio 2019 I have "Unpushed Commits" as seen below:

enter image description here

When I try to push them I get the error and this is what it looks like on the GUI: enter image description here

note: the yellow label with "Failed to push..." is not clickable.

The Output from Source Control - Git is as follows: enter image description here

The output window doesn't show me any useful details. Am I looking in the wrong place? Is there a better place to see the actual error?

The answer in this case is that the policy on the branch 'develop' does not allow direct pushes. I was kinda hoping that the error in the output would state something like 'Failed to push due to a policy constraint on the branch'

like image 553
Sniipe Avatar asked Sep 16 '20 10:09

Sniipe


Video Answer


2 Answers

Have few reasons for this case:

  1. Try pull, then push.
  2. Check permission (you maybe haven't permission to push, after a change). You maybe push to just protected branch.
like image 118
Do Nhu Vy Avatar answered Oct 26 '22 10:10

Do Nhu Vy


I was getting the same error and after trying lot of things, I found the solution.

Solution - Go to your GitHub account >> Profile >> Emails >> "Keep my email addresses private" - >> Uncheck this option.

Note : - This error may occur due to various reasons. This is the one of reason to fail the Push operation. To know the exact reason check your Output window in Visual Studio.

like image 38
Sudhir Yadav Avatar answered Oct 26 '22 09:10

Sudhir Yadav