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:
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.
CodePudding user response:
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:
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
box.
CodePudding user response:
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:
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.