天天看點

git踩過的坑

一、git 解決fatal: not a git repository

我用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 分支

然後就可以了