git踩过的坑 一、git 解决fatal: Not a git repository 二、warning: You appear to have cloned an empty repository 三、修改git已经commit的邮箱和用户名 四、git分支代码报错  

我用git add file添加文件时出现这样错误:

fatal: Not a git repository (or any of the parent directories): .git

提示说没有.git这样一个目录,解决办法如下:

git init就可以了!

二、warning: You appear to have cloned an empty repository

三、修改git已经commit的邮箱和用户名

第一步:前往需要修改的版本

1、使用 git log 获取需要修改的版本id

2、使用 git reset –soft [版本号] 前往版本

第二步:修改信息

使用 git commit --amend --author='用户名 <邮箱>'修改
在打开的文件中保存一下就可以了
第三步:提交代码

使用 git push

四、git分支代码报错

git clone master

git checkout 分支

然后就可以了