Blog Post

Creating Empty Repos in Azure DevOps–#SQLNewBlogger

,

I saw someone struggling with getting started with a Visual Studio project and Azure DevOps. They got a conflict, which I’ll show and then get you started with an empty repo.

Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

The Problem with Initialized Repos

First, I’ll open VS 2019 and create a new database project. I won’ t walk through that, but once I do, then I can add my project to source control. In the lower right corner, this is an option:

2023-08-09 12_58_07-Zoomit Zoom Window

I’ll choose a local repository here. I see plenty of people do this if they don’t want to use GitHub.

2023-08-09 12_58_34-

Now, I go to Azure DevOps and create a project. I initialize that project with a Readme, which seems like a good idea. You can see my online repo below:

2023-08-09 12_56_01-VS DB Project Test - Repos

When I create this, I get the options to link an existing repo or push up.

2023-08-09 12_59_54-Database2 - Microsoft Visual Studio

However, if I try to link my existing local repo, I get an error.

2023-08-09 13_00_19-Database2 - Microsoft Visual Studio

Why? I have a commit in the report (initialized with a readme) and commits locally. That’s a conflict.

Creating an Empty Repo

The way to avoid this is make an empty repo in Azure DevOps without anything in it. When you see this screen, un check the “add a README”. No matter how much you want to have one, don’t do this.

2023-08-25 16_35_11-VS DB Project Test - Repos

Now, you have an empty repo for the remote. You should see this online, with the first line noting this is empty. From here, you can use the second box to push your repo from the command line.

2023-08-25 16_36_17-Files - Repos

SQLNewBlogger

This post was easy for me, but I’ve been in the situation where I’ve made this mistake. It’s annoying, but it’s also confusing as you should be able to make changes in both repos. That’s why we use git.

You can, but not when both are initialized. You need to clone one from the other.

This post took me about 15 minutes to create, with a good portion of time spent creating the scenario twice (two repos) and the db project in VS, which is slow. You could do this same thing and show how (and why) you set up a project linked to source control. If you use a couple systems (one at work and one at home) make two posts!

Original post (opens in new tab)
View comments in original post (opens in new tab)

Rate

5 (1)

You rated this post out of 5. Change rating

Share

Share

Rate

5 (1)

You rated this post out of 5. Change rating