creat a new repository

  • vim README.md
  • git init
  • git add README.md
  • git commit -m “init project”
  • git remote add origin https://github.com/User/project.git
  • git push -u origin master

push an existing repository from the command line

  • git remote add origin https://github.com/User/project.git
  • git push -u origin master

use replace the ‘https’ to ‘ssh’

git remote add origin git@github.com:User/project.git

remote: Permission to UserA/AngularJSTrial.git denied to UserB.

another way to sovle the problems

  • edit .git/config file under your repo directory
  • find url=entry under section [remote “origin”]
  • change it from
    • url=https://MichaelDrogalis@github.com/derekerdmann/lunch_call.git to
    • url=ssh://git@github.com/derekerdmann/lunch_call.git. that is, change all the texts before @ symbol to ssh://git
  • Save config file and quit. now you could use git push origin master to sync your repo on GitHub