首页 > 解决方案 > 通过 Gitbash/命令行将存储库添加到 GitHub 时遇到问题

问题描述

当我尝试GitHub通过命令行将项目文件夹推送到时,我收到错误消息“

致命的:不是 git 存储库(或任何父目录):

.git”,然后我将链接粘贴到存储库并输入“ git push -u origin master。”这里发生了什么?

标签: githubcommand-linerepositorygit-bash

解决方案


If you want to do create fresh one and delete existing one then follow below steps:

Open git bash command prompt 

--remove the history from
rm -rf .git

--recreate the repo
git init
git add .
git commit -m "initial commit"

--push to the github repo
git remote add origin git@github.com<you git loc>
git push -u --force origin master

推荐阅读