Git命令学习

git config --global user.name "xxd"
git config --global user.email "[email protected]"

免密钥登录(本地和远程),配置SSH
在本地配置:
ssh-keygen -t rsa -C  "[email protected]" 会生成两个文件,后缀是pub文件打开,复制文本放在远程的github ssh key里
发送给远程:
在git上面 setting->SSH and GPS keys

测试连通性:
ssh -T [email protected]

本地新建git项目:
git init 

新建远程项目:
https://github.com/ssd/flash.git

本地-远程关联:
git remote add origin https://github.com/ssd/sd.android.git

git remote add origin https://github.com/ssd/vince.nce.git
git remote add origin [email protected]/dsd.git


https://github.com/ssd/sd.android.git

更新远程代码:
git pull --rebase origin master

推送本地代码
git push -u origin master

git rm -r --cached gradle
git commit -m "删除文件" 
git push

create a new repository on the command line
git init
git add README.md
git commit -m "first commit"
git remote add origin [email protected]:zhesju/vinceRepository.git
git push -u origin master

push an existing repository from the command line
git remote add origin [email protected]:zhswdu/vinceRepository.git
git push -u origin master

清空数据:
git add -u; git commit -m "commit deleted files"; git push -u origin master

查看远程仓库
git remote -v
控制台输出
origin https://github.com/user1/myRepository.git (fetch)
origin https://github.com/user1/myRepository.git (push)


 

你可能感兴趣的:(Git命令学习)