git的使用 推荐progit http://iissnan.com/progit/
安装git
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
查看git是否安装以及版本
git --version
快速使用git将本地工程上传到github
配置git
git config --global user.name "Your Name"
git config --global user.email "email address"
查看配置
git config --list
创建本地仓库
git init localrepo
然后进入到仓库路径下
添加文件
可以新建也可以复制过来,如test.cpp
git add test.cpp
提交
提交信息自己定义,-m后面必须有这个参数
git commit -m "create a git project"
提交到github
git remote add origin 自己的github中的一个repository的url,格式是http://****.git
git push origin master
第二次在同一个github的repository中提交新文件的时候不需要git remote add origin
Git Linux 配置自动补全
首先,拷贝https://github.com/samlaudev/ConfigurationFiles/blob/master/git/git-completion.bash 到~/.git-completion.bash
其次
sudo vim ~/.bashrc
添加
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
然后
source ~/.bashrc
git mac 配置自动补全
git 密码缓存
git config credential.helper store