git操作常用

用户认证配置
git config--global user.name "your_account"
git config –globaluser.email youremail@example.com
ssh-keygen -t rsa -C "邮箱"
一路回车即可
~/.ssh 下会生成公钥私钥

初始化仓库,推送远程
git init // 初始化版本库
git add . // 添加文件到版本库(只是添加到缓存区),.代表添加文件夹下所有文件
git commit -m "first commit" // 把添加的文件提交到版本库,并填写提交备注
git remote add origin 你的远程库地址 // 把本地库与远程库关联
git push -u origin master // 第一次推送时

乱码问题
git config --global core.quotepath false
git config --global gui.encoding utf-8

修改远程仓库地址
git remote set-url origin 远程地址

原文地址:https://www.cnblogs.com/smilem/p/13170006.html