Options

Setting up source control with Bitbucket

We have an Atlassian Bitbucket (Git) server in our company network.  We are looking at implementing a source control solution for SSMS (shared environment where we all work on 2 central servers and databases).  After installing RedGate Source Control, I attempt to link our test database to source control.  However, when I click 'Git', it asks for the 'folder'.  No matter what (empty) folder on my local hard drive I select, the software says that "this is not a Git folder".  

However, how do I configure the software to connect to the Bitbucket server to create and store the remote repo?
Where do I specify which folder on my local hard drive will act as the local repo?
Tagged:

Answers

  • Options
    Sergio RSergio R Posts: 610 Rose Gold 5
    Before linking the DB to Source Control, you need to clone the remote to your system using a git management tool (or the git command line), for example.

    After the remote has been cloned locally you can then link the database to it using SQL Source Control and create a DB folder inside it.
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
  • Options
    jornvangojornvango Posts: 16 New member
    edited May 14, 2018 3:40PM
    Do I need to use a 3rd party git management tool also to keep my local repo synced to the online/remote repo? (as in, Redgate doesn't handle this)

    If this is the case, is this an expected upgrade in the future? We are evaluating source control software for SSMS.  Having to use additional 3rd party software to keep everyone's local repo synced to the online repo (=Bitbucket server in our AD domain) sounds like an unneeded headache as competitors (such as ApexSQL) have this integrated in their product.

    Thanks!
  • Options
    Sergio RSergio R Posts: 610 Rose Gold 5
    No, if you use the default Git connection method you can Push/Pull from SSMS using SQL Source Control
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
  • Options
    jornvangojornvango Posts: 16 New member
    Push/pull to the local or remote repo?

    Does the default Git connection method support Bitbucket?
  • Options
    Sergio RSergio R Posts: 610 Rose Gold 5
    With Git it's a 2 stage process: you commit to the local repo and then push the changes from local to remote (the reverse is get latest\pull).

    You can do both in SSMS when using SQL Source Control's default Git method (the one you use when selecting Git when linking the DB).

    Yes, the default Git connection method should work with Bitbucket.
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
  • Options
    jornvangojornvango Posts: 16 New member
    I'm not understanding.  I understand it's a 2 stage process: the local repo (on each developer's hard drive) and the remote repo (Bitbucket).  In an earlier comment you mentioned that we need a 3rd party tool to clone the remote repo to the local repo.
    Now you're saying that once that is done, Redgate can handle the push/pull from SSMS to both the local and remote repo?
  • Options
    Sergio RSergio R Posts: 610 Rose Gold 5
    Yes, that's correct. You can't use SQL Source Control to clone the remote but after you have a local clone in place it will Push/Pull to and from the remote.
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
  • Options
    jornvangojornvango Posts: 16 New member
    Thanks!  Is documentation available on where to specify the Bitbucket server details in Redgate?  When I go to the git setup, I can only enter details for the local repo folder.
  • Options
    Sergio RSergio R Posts: 610 Rose Gold 5
    You only need to set the local repo in SQL Source Control.

    SQL Source Control will automatically use the config that was put in place when you setup the clone.
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
  • Options
    Sergio RSergio R Posts: 610 Rose Gold 5
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
  • Options
    jornvangojornvango Posts: 16 New member
    Thanks!  To clarify: once the remote repo is synced to the local repo, when we do a push/commit to the local repo from SSMS, automatically it will push to the remote repo as well?
  • Options
    Sergio RSergio R Posts: 610 Rose Gold 5
    edited May 14, 2018 4:53PM
    No, it's a 2 stage process: first you commit and then you push
    This short video demonstrates how this works: https://www.youtube.com/watch?v=Pv13GpjGVmY&index=1&list=PLhFdCK734P8ABTs84EAK_x5viEAIV1l3W

    (please note that video demonstrates a previous version so there are some minor differences, mostly cosmetic)
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
  • Options
    jornvangojornvango Posts: 16 New member
    Thanks!  Some more questions:

    1. I'm setting up a test database in SSMS so there is no remote repo of it yet.  Does the same apply: I commit to a (blank) local repo and then will have to use a 3rd party tool once to push to Bitbucket after which Redgate will handle the future commits/pushes from within SSMS?

    2. When I select "Git" in Redgate and select a blank folder on my hard drive, it says "That folder isn't in a Git repository".  How do I create one since I have no online repo to clone?

    3. When I select "Git" in Redgate, it only allows me to select "Dedicated database".  However, we all work on a shared/central SQL server so I need to be able to select "Shared database".  Does this "database" apply to the actual SQL server database or the local repo?
  • Options
    Sergio RSergio R Posts: 610 Rose Gold 5
    1- Once you link your local to the remote you should be able to Push/Pull from SSMS

    2 - You can use the git-init command for this.

    3- Shared and Dedicated refers to the live development database(s). 
    Based on your post it looks like your team is using the shared model.
    The default git method in SQL Source Control only supports the Dedicated model , we don't recommend using the shared model with git, but if you really want to use it, you can connect using an alternate method: the Custom setup , however this method provides lesser functionality than the default method: you will not be able to Push/Pull or see revision history in SSMS.
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
  • Options
    jornvangojornvango Posts: 16 New member
    Thanks! To follow-up on question 3: you recommend using the dedicated model where each developer works on his own database before pushing tested changes to the (1) live production database?
  • Options
    jornvangojornvango Posts: 16 New member
    Sergio,

    1. Why don't you recommend git with the shared model?  Is there something inherently troublesome with Git regarding the shared model?

    2. Can you recommend an alternative to git that will allow us to use the shared model?  We don't have to use Bitbucket.  We are open to looking at a solution that will allow us to use it in the best possible manner.  E.g. TFS?
  • Options
    AmyAmy Posts: 1 New member
    Hey Sergio, I am getting the issue "
     'git' is not recognized as an internal or external command,
    operable program or batch file. " when I try to commit. But I see the new view in my working copy file structure.
    I reinstalled Source tree but I am not sure where to go from here. Thoughts?
  • Options
    NiquemNiquem Posts: 2 New member
    edited October 23, 2018 8:05PM
    Heres my hastily redacted user doc for integrating SSMS/RedGate SC/BitBucket via Sourcetree

    HTH
  • Options
    NiquemNiquem Posts: 2 New member
    edited October 23, 2018 8:11PM
    I have added in my redacted documentation I wrote today after going through this myself. (SSMS/RedGate/BitBucket/SourceTree)

    I had to export into Word, so apologies for the horrid looking presentation

    HTH
Sign In or Register to comment.