First Repository on Github
Generating SSH Keys
check for ssh keys
[dyl[email protected] .ssh]$ cd ~/.ssh
[[email protected] .ssh]$ pwd
/home/dylan/.ssh
generate a new ssh key
[[email protected] .ssh]$ ssh-keygen -t rsa -C '[email protected]'
[[email protected] .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
[[email protected] .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
-
GitHub -> Create a new repo
[email protected]:dylanninin/blog.git
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
[[email protected] ~]$ ll
total 4
drwxrwxr-x 6 dylan dylan 4096 Jul 2 22:18 blog
[[email protected] ~]$ cd blog
[[email protected] blog]$ git init
Initialized empty Git repository in /home/dylan/blog/.git/
[[email protected] blog]$ git add *
[[email protected] 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
[[email protected] blog]$ git remote add origin [email protected]:dylanninin/blog.git
[[email protected] 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
[[email protected] blog]$ rm *.pyc
[[email protected] 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'
[[email protected] 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
[[email protected] 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