Changing the Origin in Git–#SQLNewBlogger

I needed to show a customer how to migrate from Azure DevOps to GitHub recently, and to smooth this process, we needed to repoint the origin remote.

Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers. You can see all posts on Git as well.

Changing the Remote

When you want to see remotes, you run this code:

git remote –v

As you can see, I have my origin pointed to Azure DevOps..

2023-12-19 11_46_54-cmd

Now, I can delete and add back the origin remote if I want, but there is an easier way. I’ll use the set-url parameter with this code:

git remote set-url origin https://github.com/way0utwest/DatabaseDevOpsMS.git

This points the origin to my new remote in GitHub. Once I run this, I’ll set the branch and push, as the GitHub repo is empty. This pushes everything to GitHub and voila, I’ve got code there.

2023-12-19 11_48_22-cmd

You can see this online

2023-12-19 11_35_59-way0utwest_DatabaseDevOpsMS — Mozilla Firefox

SQL New Blogger

I had to write this up in more detail for a customer as documentation. You might do this at work for someone, but I grabbed this focused, small piece of this and created my own blog, reusing a few screenshots.

Note: Don’t reuse screenshots of company assets. Recreate this in your own space.

This took me only about 5 minutes to write up after the other work was done. You could easily do that.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , , . Bookmark the permalink.