First you will need the git utilities which can be found here: http://git-scm.com/
I assumed you are using Windows and installed it to the PATH as well; otherwise you will need to use the Git Shell.
You also need the GitHub app, which you should know where to get (hint: github.com).
This will be the easiest way to do it.
You can just use git shell but you'll need to manually register the machine on GitHub and use the git's add and commit calls. Also the GitHub's some nice additional features like code comparison and a GUI (I know GUIs sometimes get a bad rap from power users but sometimes they actually make things easier and shell)
The steps below are assume you:
- have the above set up, obviously
- have an existing C# project, but any project would be similar and you can probably figure it out
- creating a new GitHub repo for the project
I sometimes have projects with multiple child components each with their own .csproj, but the solution puts it all together and they really should be treated as 1 project. So for those, I would use the first choice.
In the folder, type and execute
git init
In Explorer, go to the folder containing the project folder (1 level higher than the folder in which you created the repo)
Drag the folder into GitHub which will then list the files in the folder and sub folders.
You will see the files that are added, most likely you don't want the build files like bin/*, obj/*. You do this by creating a .gitignore file but you can use GitHub to do it for you:
With the new repo selected, on the top right, you should see a widget icon which when clicked it will display a menu. Click on the "Repository Settings..." option.
Click on them and they will create the default files. I've never touched the Attributes but you may need to edit "Ignored files" if you have some custom files you want ignored.
You can add individual files with their exact name, or folders which need to be in the format: <folder name>/
You can also use * in the as a wildcard so "myFile*" would exclude any file beginning with "myFile"
"myFolder*/" would match any folder beginning with "myFolder", and all its subfolders as well.
You can also use * in the as a wildcard so "myFile*" would exclude any file beginning with "myFile"
"myFolder*/" would match any folder beginning with "myFolder", and all its subfolders as well.
Now once, this is done, exit the settings and the Files To Commit list should update appropriately.
When you have reviewed all the files, commit it to master by first filling out at least the Summary field (when that is filled out, the Commit button will be enabled).
You have now added the files to your local repository. You need to click "Publish Repository" for the project to be created on GitHub.
Then, the button will turn into "Sync" and you need to click this for your files to be added to GitHub.
Again, "Sync" actually copies the files (not Commit, not Publish Repository).
For subsequent commits, you follow a similar process, "Commit to master" will commit the changes to the local repo, "Sync" will send them to GitHub.