Kasrak
Kasrak

Reputation: 1561

Visual studio ask me to clone the same project which is already in the DevOps

I am new to DevOps and Git. (time ago was using VisualSVN)

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.

How can I tell Azure DevOps and Visual Studio that this project is the same project in the repo and sync them.

Guess the question and issue should be a simple one.

Upvotes: 1

Views: 765

Answers (1)

VonC
VonC

Reputation: 1324917

Running that command said : "fatal: not a git repository (or any of the parent directories): .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.

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.

Upvotes: 1

Related Questions