Warm tip: This article is reproduced from stackoverflow.com, please click
github visual-studio repository

Push current code to existing GitHub repository

发布于 2020-03-27 10:24:48

I have several Visual Studio solutions that have both a local repository and one on GitHub. I've already made many changes and successfully pushed those changes to GitHub.

But now Visual Studio has forgotten that one of my local repositories is associated with a GitHub repository and I can't seem to figure out how to reconnect it. In fact, it no longer lists that repository in my list of GitHub repositories.

In the image below, you can see I have a local repository called Toxic, but that repository does not appear in the list of GitHub repositories. If I try publishing the Toxic project to GitHub, it just tells me the repository already exists.

enter image description here

How the heck can I get all of my existing Github repositories to show up in the top section shown above so I can push my latest changes?

Questioner
Jonathan Wood
Viewed
77
Jonathan Wood 2019-06-29 06:48

Unless I'm missing something, it appears the only option is to clone the GitHub repository locally, copy my modified files over the newly created repository, and then check in my changes.

Of course, I lose all my comments and iterations since the last check in to GitHub. And care had to be taken not to delete the .git folder, and to copy over all changed file and delete any that had been removed. Seems like there should be an easier way but this certainly did the trick.