Visual Studio要求我克隆DevOps中已经存在的相同项目 [英] Visual studio ask me to clone the same project which is already in the DevOps
问题描述
我是DevOps和Git的新手.(以前使用的是VisualSVN)
I am new to DevOps and Git. (time ago was using VisualSVN)
我想将项目对它之前创建的DevOps存储库的新更改提交.几天来,我反复进行更改,提交并推送到存储库.不知道为什么现在过了几天我还是不能这样做.也许是超时的事情,与存储库的断开连接.
I wanted to commit a project's new changes to it's DevOps repository which I created earlier. For some days repeatedly I made changes, commit, push to the repository. Don't know why now after some days I am not able to do so. Maybe a time-out thing, a disconnection from the repo.
顺便说一句,在那之后我似乎需要重新连接到仓库,但是在连接之后,它反复要求我克隆相同的项目,我正在研究它.
By the way, after that seems I needed to reconnect to the repo, but after the connection, it repeatedly asks me to clone the same project, which I am working on it.
如何告诉Azure DevOps和Visual Studio该项目与存储库中的项目相同,并进行同步.
猜想问题和问题应该很简单.
推荐答案
运行该命令时说:致命:不是git存储库(或任何父目录):. git"
Running that command said : "fatal: not a git repository (or any of the parent directories): .git"
如果您在 .git
文件夹本身中运行该命令,就是这种情况.
您应该在 .git
的 parent 文件夹中运行 git remote -v
.
然后,您可以查看它是否引用了Azure DevOps Git存储库.
请参阅"Azure存储库/克隆现有的Git存储库"以获取更多信息.
That is the case if you run that command inside the .git
folder itself.
You should run git remote -v
in the parent folder of .git
.
Then you can see if it references the Azure DevOps Git repository.
See "Azure Repos / Clone an existing Git repo" for more.
实际上,在讨论之后,它出现了 .git
文件夹已损坏.
解决方法是删除它,然后使用 git init重新创建.
,然后将其重新导入到Visual Studio中.
但这也意味着在其中创建的提交将与远程回购的现有历史记录有所不同.
Actually, after discussion, it appears the .git
folder was somehow corrupted.
Deleting it, re-creating it with a git init .
, and re-importing it to Visual Studio was a workaround.
But that also means the commit created in it would differ from the existing history of the remote repo.
然后,在新的本地存储库中创建提交后,我将执行以下操作:
I would then, after creating a commit in the new local repo, do:
git fetch origin
git reset --hard origin/master
git cherry-pick <the commit created before>
这将应用在远程历史记录之上本地进行的任何修改.
That would apply any modification done locally on top of the remote history.
这篇关于Visual Studio要求我克隆DevOps中已经存在的相同项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!