Adding local code to git

  1. Create the new repository: https://github.com/new
    1.1 Example name EventLogger
    1.2 Create as Public and dont add a README yet

  2. Locate your folder in a command terminal: example C:\Dev\EventLogger
    2.1 run git init, this will create a .git folder

  3. Set the Git commit user setting
    3.1 C:\Dev\EventLogger\.git\config
    3.2 Add as follows

1
2
3
[user]
name = Carl
email = carl.paton@gmail.com
  1. Run git add . to stage your local files
    4.1 Run git status to confirm your files are added/staged

  2. Run git commit -m "first commit"
    5.1 Run git log to confirm your user setting`

  3. Run git remote add origin https://github.com/carlpaton/EventLogger.git

  4. Run git push -u origin master

Optional

  1. Update the config to include your credentials
1
2
[remote "origin"]
url = "https://USERNAME:PASSWORD@github.com/carlpaton/EventLogger.git"
  • NOTE: Credentials are stored in plain text!

test