将代码上传到Github

在github中新建仓库my_blog_tutorial, 填写简单的描述。

  1. #查看当前目录位置
  2. $ pwd
  3. /Users/andrew_liu/Python/Django/my_blog
  4. #在项目的根目录下初始化git
  5. git init
  6. Initialized empty Git repository in/Users/andrew_liu/Python/Django/my_blog/.git/
  7. #添加远程github
  8. $ git remote add blog git@github.com:Andrew-liu/my_blog_tutorial.git

在根目录下增加`.gitignore’和’LICENSE’和’README.md’文件。

  1. #添加所有文件
  2. $ git add .
  3. #查看当前状态
  4. $ git status
  5. #commit操作
  6. $ git commit -m "django tutorial init"
  7. #上传github
  8. $ git push -u blog master
  9. Counting objects: 23, done.
  10. Delta compression using up to 4 threads.
  11. Compressing objects: 100% (22/22), done.
  12. Writing objects: 100% (23/23), 19.56 KiB | 0 bytes/s, done.
  13. Total 23 (delta 1), reused 0 (delta 0)
  14. To git@github.com:Andrew-liu/my_blog_tutorial.git
  15. * [new branch] master -> master
  16. Branch master set up to track remote branch master from blog.