下载安装git[ linux]
下载安装最新版本的 Git.
#sudo apt-get install git
设置Git
用户名Username
首先你需要告诉Git你的名字,这样在提交的时候才可以辨别是你提交的。
git config --global user.name "lixiaolong"
邮箱Email
git config --global user.email "lixiaolong@163.com"
Overriding settings in individual repos
缓存密码Password caching
git config --global credential.helper cache
# Set git to use the credential memory cache
By default git will cache your password for 15 minutes. You can change this if you like.
git config --global credential.helper 'cache --timeout=3600'
# Set the cache to timeout after 1 hour (setting is in seconds)
创建REPO
Congratulations! You have successfully created your first repository!
第一步:在github上创建一个REPO
第二步:克隆REPO到本地
git clone https://github.com/userName/yourRepo.git
git init
# Sets up the necessary Git files
第三步:
git remote add origin https://github.com/userName/yourRepo.git# Creates a remote named "origin" pointing at your GitHub repository
//为第一次提交添加注释
git commit -a -m 'first commit '
git push --set-upstream origin master
以后提交代码直接就是一下的几个步骤:
git status //查看状态
git commit -a//添加注释
git push//提交代码