Github其實也可以作為文件分享的地方,但是免費空間只有300M,所以不能存放大文件,否則可以成為一個分享資源的下載站,而且非常方便。
常用命令:
git add . //添加所有的文件到索引
git commit //向本地源碼庫提交,會打開默認vi編輯器寫 “注釋”
git remote add origin git@github.com:viprs/Hello-World.git //添加遠程目標為origin
git push origin master //把本地源碼庫push到Github上
git pull origin master //從Github上pull到本地源碼庫
注意:(git commit -m 'remove aa.txt'
-a 千萬不要用-a強制全部提交,一個項目提交幾次就占用150M/300M)
例子:新建一個“
ProjClean”項目,下面是具體操作步驟。
Global setup:
Set up git 告訴github你是誰
git config --global user.name "viprs"
git config --global user.email xxx@gmail.com
Next steps:
mkdir ProjClean
cd ProjClean
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin https://github.com/viprs/ProjClean.git
git push -u origin master
Existing Git Repo?
cd existing_git_repo
git remote add origin https://github.com/viprs/ProjClean.git
git push -u origin master //-u 是提示用戶名、密碼
Importing a Subversion Repo?
Check out the guide for step by step instructions.
When you're done:
Continue