windows git 使用

1 Git基础配置

1.配置用户名(提交时会引用)
git config --global user.name "aslan"

2.配置邮箱(提交时会引用)
git config --global user.emali "978820441@qq.com"

3.配置其他
git config --global core.autocrlf false (让git不要管windows/linux换行符转换的事)

4.编码配置
git config --global gui.encoding utf-8  (避免git gui中的中文乱码)
git config --global core.quotepath off  (避免git status的中文文件乱码)

5.windows上还需要配置:
git config --global core.ignorecase false

2. git ssh key pair 配置

1.在linux 或者windows的gitbash下输入:
ssh-keygen -t rsa -C "978820441@qq.com"

2.一直回车,不要输入任何密码,生成ssh  key pair

3.ssh-add ~/.ssh/id_rsa 
出现了下面的错误 Could not open a connection to your authentication agent.
解决办法:
执行 eval `ssh-agent`  (~的那个点)
再执行 ssh-add ~/.ssh/id_rsa  

4.cat ~/.ssh/id_rsa.pub 拿到私钥

3.在码云,github配置公钥

4.git clone 项目

git clone  ***********.git  

5.创建分支

1.查看当前分支 
git branch

2.从v1.0生成新的v2.0分支
git checkout -b v2.0  origin/v1.0

3.远程git创建新的分支
git push origin HEAD -u

6.git commit遇到的错误

$ git commit -am "ddd"

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'eva@DESKTOP-MU1TOKN.(none)')

解决办法:

cd .git

vim config
添加下面的内存
[user]
      email="xxx@qq.com"
      name=aslan

7.删除远程仓库中的文件夹

git rm -r --cached .idea  #--cached不会把本地的.idea删除
git commit -m 'delete .idea dir'
git push 
posted @ 2018-01-06 07:37  snakejia  阅读(203)  评论(0编辑  收藏  举报