Using GIT with Visual Studio and a Local project

Git usage with visual studio has become easier in recent times, but I always still have a bit of a headache remembering a few basic items. For instance, I use bitbucket.org for a lot of private repositories, and I often will have source code on my local machine that I’d like to add to git and then sycn with bitbucket. Visual studio seems to not like creating a new git repository in a folder that has files in it already, but I don’t usually want to move files into a new folder. Apparently I have to drop to the commandline and run:

cd <my project path>
git init

After this, you can go back into visual studio and add the newly initialized git repo to it, while you already have the solution open: go to Add, then navigate to the folder and add it.

Then, do a commit.

Then, you can go to sync, to sync it with bitbucket- but you’ll need to go to bitbucket and create the repo there first, then copy the url to the repo. Enter this in the visual studio prompt and then complete the sync.