yum -y install git
ssh-keygen -t rsa
cd ~/.ssh/
配置githubSSH keys,将*。hub的内容拷贝过去
ssh -T git@github.com #测试
- 初始化配置
git config --global user.name anyyyy
git config --global user.email 931145352@qq.com
git config user.name/email #查看用户和邮箱
- 指定代码厂库(repository)
git config --global user.name "your name" //配置用户名
git config --global user.email "your email" //配置email
- 在Git上添加一个Repository
- 利用Git从本地上传到GitHub
git init #初始化git版本库
#git remote add origin git@github.com:anyyyy/test.git 将本地厂库与远程库相关联
不知道什么作用
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
- 操作
git add file #将特定文件加入到厂库缓存区
git add . #将所有文件加入到厂库的缓存区
git commit -m "注释"
git push
#git push -u origin master
- 更新本地版本
git fetch origin
- 把更新的内容合并到本地分支
git merge origin/master
问题
- 更新被拒绝
- 强行上传 git push -u origin +master
- 尽量先同步github上的代码到本地,在上面更改之后再上传
命令
- 查看分支:git branch
- 创建分支:git branch
- 切换分支:git checkout
- 创建+切换分支:git checkout -b
- 合并某分支到当前分支:git merge
- 删除分支:git branch -d