How to upload projects to Github

July 10, 2016    Git GitHub Projects Repository

How to upload projects to Github

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.

  1. If upload of the project is from scratch
  2. $ 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]
  3. Upload an existing project
  4. $ 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]
  5. Updating each time after upload
  6. $ git add .
    $ git commit -m "write comment here"
    $ git push origin master [add --force if it doesn't work]

Fork me on GitHub