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

使用git命令新增文件,报错:

[email protected] MINGW64 /d(master) $ git add aaa.txt                           
fatal: not a git repository (or any of the parent directories): .git                            

原因: 本地git 与 github之间的通信断开

测试连接

[email protected] MINGW64 /d(master) $ ssh -T [email protected]

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

解决办法:

将本地 id_rsa.pub(公钥)的内容,添加到 GitHub  SSH keys

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

配置好之后,重新测试连接

[email protected] MINGW64 /d(master) $ ssh -T [email protected]

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

重新切换到master分支下,重新添加文件即可。