obevan
obevan

Reputation: 166

Why does Visual Studio Code force me to use a remote GitHub repository?

Having initialised a local repo and made an initial commit, VS code prompts me to 'Publish Branch' on GitHub.

I don't want to use GitHub as I am happy using a local repo in this case. Is this possible? I can't find an option to ignore the 'Publish Branch' prompt.

Before initializing a repository:

pre init

After initializing a repository:

after init

After committing:

after commit

Upvotes: 2

Views: 1223

Answers (1)

Gino Mempin
Gino Mempin

Reputation: 29580

It's not really forcing you or prompting you to publish your repo to Github.

It's more of an option, a hint, or a recommendation, since when someone uses Git, they typically would want to push/publish their local copy of the repo to some remote copy of the same repo (ex. for sharing with other members of your team, etc.). But it's perfectly fine with Git and with Visual Studio Code's Source Control functions if all you want is to maintain it all locally. It shouldn't be blocking you from doing further local commits.

So

I don't want use GitHub do as I am happy using a local repo in this case - is this possible?

YES.

I can't find an option to ignore the 'Publish Branch' prompt.

If you don't want to see that button, you can hide it with the setting Git: Show Unpublished Commits introduced in VS Code 1.61 September 2021

By default, the Git extension will add a Sync Changes button as shown above, if there are unpushed commits, or a Publish Changes button if the branch hasn't yet been published. Additionally, users can customize this behavior by configuring the git.showUnpublishedCommitsButton setting, which defaults to whenEmpty so that the button will only be shown if there are unpushed commits and there are no other changes in the view.

git.showUnpublishedCommitsButton settings UI

"git.showUnpublishedCommitsButton": "never"

Just thought it looked a little odd as it differed from (albeit old) docs showing nothing, seemed intrusive, and was different to what I'm used to.

It's probably part of the continuous updates that further integrated Github with VS Code's UI (since both are now owned by Microsoft). The section on Initializing a Repository doesn't mention that it's required to publish to Github or to any other provider.

And to be clear, you can use pretty much any remote repo server/provider. It doesn't have to be Github. (Although the built-in UI is specifically tailored to use Github.)

Upvotes: 2

Related Questions