How to upload files to GitHub

I have a feeling that there aren’t many clear and simple tutorials containing information on how to quickly get started with GitHub – specifically, info on how to perform a task of uploading project into online repository. Although there is a nice Windows application available for GitHub, believe it or not, I prefer to use Shell, although I normally like working with tools that have impressive visual interfaces :).

In order to upload (the correct word would be “push” actually) your project files into online repository, you will  have to do the following first:

  1. Create a repository
  2. Download and install Git tools (you will be interested in Shell)

This will take few minutes only. Now the real work begins.

  1. Start Git Shell and navigate to folder where you’ll want to manage your repositories (you may be interested in changing default path – so was I!).
  2. Copy HTTPS clone URL into clipboard.
  3. For any new repository, you will need the Clone command first, which syntax is git clone HTTPS cloneURL, so you will have something like git clone https://github.com/bbirdme/BBird-Under.git
  4. Now copy all the files you want to push into the folder the clone command created (it will have the same name as your repository).
  5. Now use command git status – if you see some files in red, these are the files that are different from your online repository and you will want to commit them.
  6. Now use command “git add .”, and then try git status again – now the red files turned into green, since they are ready to be committed.
  7. Now there are two commands left – commit and push. Git Commit prepares your files for, guess what – committing. The syntax for commit is something like git commit -m “short message about the changes made” – make sure you follow this exact syntax, because you can’t commit without commit message.
  8. Finally, you will upload (push) your files online using the following command – git push. If you refresh your browser after performing this command, you will find all the files from your computer uploaded into online repository.

Once you completed these steps, you can edit the projects’ individual files and commit them. I guess it’s obvious that you need to repeat steps from 6-8 only from now on, while it doesn’t hurt to use the git status command just to make sure you’ve modified to correct files :).

(If seeking for a visual explanation of all this, you’ll want to check this great YouTube video).