Friday, February 28, 2014

Github tutorial

1,  generate ssh key and add your public key to github
https://help.github.com/articles/generating-ssh-keys

2, test connection with github
$ ssh -T git@github.com
Warning: Permanently added the RSA host key for IP address '192.0.52.28' to the list of known hosts.
Hi gds! You've successfully authenticated, but GitHub does not provide shell access.

3, Add your project to Github
A, create a repo in github

B, in your local box,
DO:
$ git config --global user.name "Smith Chris" $ git config --global user.email schris@example.com

touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/gdsdong/csstemplate-acupuncture.git
git push -u origin master
 
git remote add origin git@github.com:gdsdong/csstemplate-decoration.git
git push -u origin master 
 
Error:
$ git push -u origin master
error: The requested URL returned error: 403 while accessing 
https://github.com/gdsdong/csstemplate-acupuncture.git/info/refs
Need to update local git config
  1. edit .git/config file under your repo directory
  2. find url=entry under section [remote "origin"]
  3. change it from url=https://github.com/xxxx/lxxx.git  to url=ssh://git@github.com/xxxx/lxxx.git. that is.
  4. Save config file and quit. now you could use git push origin master to sync your repo on GitHub




No comments:

Post a Comment