-3

In VS Code there is a source control panel. VS Code picks up and initializes the repository correctly when I open the root project folder (the directory that has the .git folder).

However, how do I see the repository settings? I can't find any options in the source control panel or the menu items. I would like to see what repository I'm working with.

I created a new repository and folder and have two directories for my project. VS Code is picking up both in the VS Code welcome screen and I've opened the wrong folder a few times now. I don't want to delete the old folder yet until I make sure the new folder is up to date and running correctly.

enter image description here

I've also installed two git extensions and I haven't found any repository information.

Here is from GitLens:
enter image description here

Basically, I would like to be able to see the repository URL that VS Code is pulling from.

I know I can open the git directory and see settings there. Because of a previous issue I want to make sure VS Code is working with the correct folder.

starball
  • 20,030
  • 7
  • 43
  • 238
1.21 gigawatts
  • 16,517
  • 32
  • 123
  • 231
  • Just `git remote -v` or view your `.git/config` file? – starball Feb 21 '23 at 19:23
  • @user Thanks. That is helpful. I'll give those a try. There are people I work with and myself included that don't know all the inner workings of git. – 1.21 gigawatts Feb 21 '23 at 19:24
  • 2
    I wouldn't really call using a _user-facing_ git command an "inner working of git" :P – starball Feb 21 '23 at 19:27
  • It sounds like you just want to see the _remote_, in which case the command "Git: Remove Remote" (see https://code.visualstudio.com/docs/sourcecontrol/overview#_remotes - it's within "Remote" in your first screenshot and) will list all configured remotes. That's also presumably where "Open Repository on Remote" would take you in the second. – jonrsharpe Feb 21 '23 at 21:02

1 Answers1

2

At the time of this writing, no- I don't think there is a built-in way to view a repository's remotes' URLs in VS Code.

But not everything has to be done through VS Code. You can just run git remote -v, which will list a repository's remotes and their push and pull urls.

But in the interest of answering the question that was asked, technically, you can open the .git/config file in an editor tab, which will show similar info. The files.exclude setting has "**/.git": true in it by default, so to open that file in VS Code, you either have to change the settings to unhide it, or use the File: Open File... command / action and find it in your operating system / desktop environment's native file explorer application (an dyou may even need to toggle a setting there to "show hidden files" to be able to see it there as well).

The last option is to look for an extension that does this or create one.

starball
  • 20,030
  • 7
  • 43
  • 238