Pushing to the wrong branch using Visual Studio 2022

Hello everyone,
We are using a Self Managed Server, we created a repo with a branch “Main”.
We pushed our files in this branch.
We also created a new branch, called “Develop”, and I would like to push to this new branch.

On Visual Studio 2022, I connected to this new branch “Develop”, but when I want to push my files to this branch, I have this message. As if we want to push to Main.

Thanks in advance,
Here is the branch I’m on, with Visual Studio
gitlab_branch
Here is the Error message I have when I push my files

Noone has an idea ?

If your branch is protected you cannot push to it. See the Gitlab docs on how to protect/unprotect branches, or change the level of permissions to allow lower levels, eg: Developers to push to protected branch.

1 Like

Thanks for your answer.
The branch where I want to push isn’t protected (Develop, in this picture).
We also can see in the Error picture a line saying "Error : Develop → main (pre-receive hook declined)
image

Something here on that: Git error when trying to push -- pre-receive hook declined - Stack Overflow you need to speak to whoever configured that repository - obviously your commits are being rejected because of something they configured. That is not something that Gitlab rejects by default.

Also get them to check what permissions you have to that particular repository/branch.

1 Like