0
votes

I have a local Visual Studio 2017 project which I want to add to an existing non-empty repo in Azure DevOps. Is that possible?

DevOps has two branches - master and a secondary branch. I would like to add local VS project to master branch. Local VS project is has same structure and code base of master branch.

I tried several approaches and one of them is the below series of commands:

Approach 1

  1. go into local vs project solution folder
  2. run "git init"
  3. git remote add origin
  4. git add .

Error: After I run git add command (#4), i get error that say db.lock permission denied and unable to open index file db.lock

Approach 2

I tried adding VS project by clicking on the "add to source control" option in the bottom right of visual studio and then selected the correct non-empty azure repo. Once i clicked publish, i saw below output:

Error: Updates were rejected because the remote contains work that you do not have locally. This is usually caused by another repository pushing to the same ref. You may want to first integrate the remote changes (e.g., 'git pull ...') before pushing again. See the 'Note about fast-forwards' in 'git push --help' for details.

Any pointers or references?

1
just replace files with your files?4c74356b41
but i want to connect and manage the code from azure repo.biostat
I don't understand how this contradicts what I've said4c74356b41

1 Answers

1
votes

Approach 1

You could add the .vs folder into the .gitignore file. The following is the detail steps, you could refer to.

1.go into local vs project solution folder

2.run "git init"

3.git remote add origin

4.create an empty .gitignore file with command type nul >.gitignore

5.copy the VS .gitignore templates content into the created .gitignore file.

6.git add .

By default .vs folder is in the .gitignore template.