0

I've searched and searched, but I couldn't find a tutorial or article on how to use Visual Studio 2022 with a different git server other than Github or Azure DevOps.

When trying to add a solution to source control and want it to create a new repository on our gitea server, I presume I have to use the 'existing remote' option:

enter image description here

but what URL do I need to add here? I tried something like 'https://git.myserver.net/myusername' even tried to a repository 'https://git.myserver.net/myusername/myrepository.git' but none works (it also doesn't ask for credentials anywhere). When I try to push the project to master I get the following:

A new Git repository has been created for you in C:\Source\VS.NET 2022\MyExampleVB. Open the Git Repository window to view its contents.
Opening repositories:
C:\Source\VS.NET 2022\MyExampleVB
Opening repositories:
C:\Source\VS.NET 2022\MyExampleVB
Commit 757a3115 created locally in repository C:\Source\VS.NET 2022\MyExampleVB
Opening repositories:
C:\Source\VS.NET 2022\MyExampleVB
Opening repositories:
C:\Source\VS.NET 2022\MyExampleVB
Pushing master
Error encountered while pushing branch to the remote repository: Git failed with a fatal error.
Git failed with a fatal error.
unable to access 'https://git.myserver.net/myuser/': Failed to connect to git.hrbox.net port 443 after 21087 ms: Timed out

Failed to push the branch to the remote repository. See the Output window for more details.

I only used git with github or Azure DevOps in the past, but the company apparently doesn't want to use either and therefore setup their own gitea server.

SuperDre
  • 157
  • 10
  • This screen is when you already have created the repository in gitea and once created, gitea will provide you the url that you will paste in the text field (and it's the same workflow whatever git hosting provider you choose : ADO, github, gitlab, gitea,...) – Philippe Oct 05 '22 at 22:57
  • No, I haven't created anything, it's a completely blank project I created and wanted Visual Studio to create a new repository in gitea. This way is the way I know when I use Github or DevOps. Or are you saying it isn't possible to let Visual Studio create a new repository directly to gitea? – SuperDre Oct 06 '22 at 08:32
  • In the end it were multiple problems, see my own answer, which hopefully is also a sort of tutorial on how to use a different git server, as I really could not find any tutorials explaining this, all were just in regard to github or devops. – SuperDre Oct 06 '22 at 10:49

2 Answers2

1

Thanx for all comments. In the end there were several problems:

  • needed to add the git server to my windows hosts file (this solved the timeout problem, even if the website itself did work properly)
  • the server wasn't setup to let users create a new repository based on push (This solved the creating of a new repository on the server directly from inside visual studio)

And the way to use a server other then Github or DevOps is by using the 'Existing remote' option and enter a new repository name which does not exist on the server yet: enter image description here

When it's the first time, it will ask for credentials for your userlogin on that specific server when you push the project onto the server.

SuperDre
  • 157
  • 10
0

If you create a repository on gitea and use that url, you should be able to enter like this for example: http://hidrogen:8089/git/test.git in the remote URL field. After clicking the Create and Push button a window should pop up:

enter image description here

asking for your gitea credentials.

I am not sure, this credential manager is the part of the OS by default, maybe you have to install it with git-scm, and while installing check the

enter image description here

box.

IamK
  • 2,753
  • 5
  • 30
  • 39
  • 1
    thanx, the problem with connecting was with the server not being visible from within windows itself, had to add the server in the hosts file. – SuperDre Oct 06 '22 at 10:47