Generating SSH Keys

check for ssh keys

[dylan@www .ssh]$ cd ~/.ssh

[dylan@www .ssh]$ pwd
/home/dylan/.ssh

generate a new ssh key

[dylan@www .ssh]$ ssh-keygen -t rsa -C '[email protected]'

[dylan@www .ssh]$ ll
total 16
-rw------- 1 dylan dylan  380 Sep 28  2012 authorized_keys
-rw------- 1 dylan dylan 1675 Jan 27 14:39 id_rsa
-rw-r--r-- 1 dylan dylan  402 Jan 27 14:39 id_rsa.pub

add ssh key to github

  • GitHub -> Accout Settings -> SSH Keys -> Add SSH Key -> Paste your public key

test everthing out

[dylan@www .ssh]$ ssh -T [email protected]
Warning: Permanently added the RSA host key for IP address '204.232.175.90' to the list of known hosts.
Hi dylanninin! You've successfully authenticated, but GitHub does not provide shell access.

Repository Quick setup

Configure username and email

git config --global user.name 'dylanninin'
git config --global user.email '[email protected]'

Create a new repository on the command line

touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin [email protected]:dylanninin/blog.git
git push -u origin master

Push an existing repository from the command line

git remote add origin [email protected]:dylanninin/blog.git
git push -u origin master

Example

init local repo

[dylan@www ~]$ ll
total 4
drwxrwxr-x 6 dylan dylan   4096 Jul  2 22:18 blog

[dylan@www ~]$ cd blog

[dylan@www blog]$ git init
Initialized empty Git repository in /home/dylan/blog/.git/

[dylan@www blog]$ git add *

[dylan@www blog]$ git commit -m 'blog init with web.py'
[master (root-commit) 58899a8] blog init with web.py
 128 files changed, 22775 insertions(+), 0 deletions(-)
 create mode 100644 __init__.py
 create mode 100644 __init__.pyc
 create mode 100644 blog.log
 create mode 100644 blog.py
 create mode 100644 blog.pyc
 create mode 100644 config.py
 create mode 100644 config.pyc
 create mode 100644 controller.py
 create mode 100644 controller.pyc
 create mode 100644 model.py
 create mode 100644 model.pyc
 ... ...

push to remote repo

[dylan@www blog]$ git remote add origin [email protected]:dylanninin/blog.git

[dylan@www blog]$ git push -u origin master
Counting objects: 144, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (142/142), done.
Writing objects: 100% (144/144), 335.43 KiB, done.
Total 144 (delta 2), reused 0 (delta 0)
To [email protected]:dylanninin/blog.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

delete pyc

[dylan@www blog]$ rm *.pyc
[dylan@www blog]$ git rm *.pyc
rm '__init__.pyc'
rm 'blog.pyc'
rm 'config.pyc'
rm 'controller.pyc'
rm 'model.pyc'
rm 'service.pyc'
rm 'tool.pyc'

[dylan@www blog]$ git commit -m 'delete pyc'

[master fbfa542] delete pyc
 7 files changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 __init__.pyc
 delete mode 100644 blog.pyc
 delete mode 100644 config.pyc
 delete mode 100644 controller.pyc
 delete mode 100644 model.pyc
 delete mode 100644 service.pyc
 delete mode 100644 tool.pyc
 
[dylan@www blog]$ git push -u origin master
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 238 bytes, done.
Total 2 (delta 1), reused 0 (delta 0)
To [email protected]:dylanninin/blog.git
   58899a8..fbfa542  master -> master
Branch master set up to track remote branch master from origin.

Reference



blog comments powered by Disqus

Published

02 July 2013

Categories

Tags

Github