project is registered as a Git root, but no Git repositories were found there

简介: 报错如下我一开始想把项目推到git,但是发现右键没有git选项。于是我去搜为什么右键没git选项。给出的答案就是在版本控制中添加。上图这个我添加的本身就是一个git项目,所以没有出现问题,但是如果本身项目还没有关联远程仓库的话,这样搞是会出现问题。

报错如下



我一开始想把项目推到git,但是发现右键没有git选项。于是我去搜为什么右键没git选项。给出的答案就是在版本控制中添加。



上图这个我添加的本身就是一个git项目,所以没有出现问题,但是如果本身项目还没有关联远程仓库的话,这样搞是会出现问题。


对于小白初次使用idea里面搞git常常会出现的问题。你看比如这样。于是我去搜了。



搜了几篇博文




其实我想知道的是我的这个项目为什么不能这样加入,我会不知道删除解决报错?而且网上的好多博文基本都是一样的解决办法,抄袭的思路都一样。给我整的有点烦。


后来我想起我添加的不是一个git项目,判别的话,就是你之前没有用这个项目和远程仓库关联,或者你没有提交过远程仓库。


现在我们来正确解决一下。


我们现在在github建立一个仓库



然后确认创建好之后复制给出的链接。




我选了项目下的一个模块



出现这个可以先不用管,上面操作完后,然后点到项目。



点到这里



这回你再右键就有了git.



然后管理远程仓库



将仓库链接复制到这里,然后okok.





在左下角这边添加注释信息



然后commit



commit Anyway and push






这样提交是ok的

这时你的idea上面的vcs变为了git,如果你要回退方便操作其他的项目到git,可以这样做。

在这里版本控制将这些全部搞为none




如果你要变为git




非常方便管理


相关文章
|
IDE Shell 网络安全
Visual Studio 2022 git error Unable to negotiate with xx.xxx.xxxx port 22: no matching host key type found. Their offer: ssh-rsa
Visual Studio 2022 git error Unable to negotiate with xx.xxx.xxxx port 22: no matching host key type found. Their offer: ssh-rsa
347 0
Visual Studio 2022 git error Unable to negotiate with xx.xxx.xxxx port 22: no matching host key type found. Their offer: ssh-rsa
|
2月前
|
开发工具 git
git push xxx not found问题解决
git push xxx not found问题解决
|
3月前
|
开发工具 git
完美解决git 执行git push origin master指令 报错command not found
完美解决git 执行git push origin master指令 报错command not found
73 0
|
开发工具 git
部署hexo遇到报错ERROR Deployer not found: git的解决办法
部署hexo遇到报错ERROR Deployer not found: git的解决办法
345 0
|
开发工具 git
git提示:There is no tracking information for the current branch
git提示:There is no tracking information for the current branch
184 0
git提示:There is no tracking information for the current branch
|
缓存 开发工具 git
git将本地项目上传到线上时遇到的一些问题:There is no tracking information for the current branch.
git将本地项目上传到线上时遇到的一些问题:There is no tracking information for the current branch.
211 0
git将本地项目上传到线上时遇到的一些问题:There is no tracking information for the current branch.
|
开发工具 git
【已解决】git取消分支合并(fatal: There is no merge to abort (MERGE_HEAD missing).)
git取消分支合并(fatal: There is no merge to abort (MERGE_HEAD missing).)
1061 0
|
开发工具 git
hexo d命令报错:ERROR Deployer not found: git
hexo d命令报错:ERROR Deployer not found: git
3169 1