GitHub is a web-based platform for software developers that enables the storage and management of code and the tracking and control of code changes via Git repositories. It makes it easy for developers to collaborate on projects and to create and manage issues, bugs, and feature requests. They can also automate testing and build processes and workflows during deployment through integration with various CI/CD tools.
Prerequisites
Make sure that you have:
The article covers the following topics:
We’ll create a new repository on GitHub, so make sure you have a GitHub account.
1. Sign in to your GitHub account.
2. In the upper-right corner of the page, click the + dropdown menu and select New Repository.
3. On the Create a new repository page that opens, enter the name and optional description.
4. Select the visibility mode:
5. Make an initial commit to the repository by selecting the options:
The default name of the branch is main. If you want to update the name, click settings under the options.
Note
If you import an existing repository, skip this step.
6. To keep the changes, click Create repository.
1. Create an empty folder on the disk of your computer where the local repository will be stored.
2. In the GitHub account, switch to the Repositories page and select the repository you want to copy to your computer.
3. On the <> Code tab, click the Code dropdown menu, select HTTPS, and click Copy to Clipboard to copy the URL of the repository.
4. In the Command Prompt, type the git clone
command, paste the URL directory you’ve copied, and press Enter to create a cloned copy of the repository.
Note
Specify a dot at the end of the command to clone the repository to the folder you have created. Otherwise, another subfolder will be created.
If you didn’t add any files to the repository when you created it for the first time, execute the following commands:
git commit --allow-empty -m initial
git push
1. In SSMS Object Explorer, right-click a database you want to link to source control and select Source Control > Link database to Source Control.
2. On the Link page of the Link Database to Source Control wizard, click + in the Source control repository field.
3. In the Source Control Repository Properties dialog that opens, select Git from the Source Control system dropdown list and provide a path to your local Git repository where dbForge Source Control will store SQL scripts.
Note
To work with a remote repository, you need a clone of this repository. To retrieve a local clone, execute the
git clone <url> <path>
command or use the GUI tool. After the successful creation of the clone, specify the path to the folder containing the clone in the Repository Folder field of the Repository Properties window. You can specify a path to a subfolder in the repository (not .git).
Note
The repository folder name represents a path to the local copy of the remote repository and must not contain the URL of the remote repository.
4. Optional: Click Test to verify that the database has successfully been connected to source control.
Note
Keep in mind that you should work with the current repository branch. For this, it should have at least one commit.
5. Click OK to apply the changes and close the Source Control Repository Properties dialog.
6. Select a database development model: dedicated or shared.
7. Click Link to establish the connection between the database and source control.
The Refresh progress window opens automatically, showing the stages of the refresh operation. The linked database gets the following icon in Object Explorer.
If you are the first person to link this database, add the database objects to source control in an ‘initial commit’: go to the Local changes section, select the objects, and click Commit. For more details, see Commit changes.
If you linked a database that is already in source control, update your database to the latest version: go to the Remote changes section, select the objects, and click Get Latest, which is available only in the dedicated model but not in the shared model. For more details, see Get the latest version.