Create a new repository on GitHub. To avoid errors, do not initialize the new repository with README, license, or gitignore files. You can add these files after your project has been pushed to GitHub. Open Terminal (for Mac users) or the command prompt (for Windows and Linux users) and go iniside the folder to be uploaded.
$ git init
$ git add .
$ git commit -m "write comment here"
$ sudo git remote add origin https://github.com/username/projectname
$ git pull origin master
$ git push origin master [add --force if it doesn't work]
$ git init
$ git add .
$ git commit -m "write comment here"
$ sudo git remote add origin https://github.com/username/projectname
$ git push origin master [add --force if it doesn't work]
$ git add .
$ git commit -m "write comment here"
$ git push origin master [add --force if it doesn't work]