Write Permissions Error when Committing Changes

Hi All,
I first tested SQL Source Control last year and just got the "real deal" installed recently. I'm very green when it comes to working with git and source control in general, please keep that in mind and don't judge. I am going through some practice steps with a test database just to make sure I have all the commands down and I also created a new SSH key pair. Now when I commit changes I get error messages such as 

Access to the path 'Z:\Y\GitLab\X\AdventureWorks\RedGateDatabaseInfo.xml' is denied.

"Z" is a network share to which my user account has full rights. This has worked before, so I'm confused what has changed and what I might need to update. I have checked for updates to SQL Source Control and am up to date.

Thank you in advance!
Tagged:

Best Answer

  • CWiseCWise Posts: 5 New member
    Just in case anyone runs into the same thing, I deleted the original folder and started over. I didn't bother trying to connect to GitLab because I already know the SSH key/passphrase isn't supported. I'm just connecting to the working folder and so far everything is working.


Answers

  • Hi @CWise

    Could I ask, with your SSH key pair, are you using a passphrase?

    Kind regards

    Dan Calver | Redgate Software
    Have you visited our 
    Help Center?

  • CWiseCWise Posts: 5 New member
    Yes, I'm using a passphrase. I know that SQL Source Control can't sync with the remote repo using SSH/passphrase. When I tested last year, I had it all working by saving to the local folder from within SSMS and then using git bash to push/pull to the remote location. The permission problem appears now when source control wants to overwrite files in my local folder. 
  • Hi @CWise

    Ah, thank you for the extra details on the process!

    Have you tried unlinking and relinking the project to the working folder?

    Does the issue appear when you try to commit the changes to the local working folder, which is then linked to Git outside of SQL Source Control?

    Kind regards

    Dan Calver | Redgate Software
    Have you visited our 
    Help Center?

  • CWiseCWise Posts: 5 New member
    Yes, the issue appears when I try to commit the changes to the local working folder. I'll try to unlink/relink, hopefully that will do the trick.
  • Hi @CWise

    Thanks for the confirmation, let me know how the unlink/relink goes and if it's unsuccessful, I'll set up an environment to test your scenario and see what results I get!

    Kind regards

    Dan Calver | Redgate Software
    Have you visited our 
    Help Center?

  • CWiseCWise Posts: 5 New member
    I just unlinked the db and now that I'm trying to link again I get the message: "That repository has staged changes. You need to commit, stash, or unstage the changes before linking." I'm guessing that is because my attempted commit completed half-way. Is there a way I can start over? This is just adventureworks, so I don't care about this particular db. 
  • DanCDanC Posts: 637 Gold 5
    edited February 16, 2021 10:04AM
    Hi @CWise

    Ah, that's frustrating, you could try Unstaging the changes in your repository through the CMD, I'd take a look at this document.

    You could also go to the following file in %localappdata% > Red Gate > SQL Source Control > LinkedDatabases.xml

    In this document, you can search for the 'AdventureWorks' and find the associated Working base and Transient folder which you can remove if they haven't already.

    It will look like the following:

    <DatabaseId version="2" type="DatabaseId">
            <ServerAndInstanceName>PS-DANC\DC_SQL2017</ServerAndInstanceName>
            <DatabaseName>AdventureWorks2017</DatabaseName>
          </DatabaseId>
          <ISrcCLocation version="1" type="GitLocalLocation">
            <LocalPath>C:\Users\Dan.Calver\Documents\adventureworks\</LocalPath>
          </ISrcCLocation>
          <IWorkspaceId version="1" type="WorkspaceId">
            <RootPath>C:\Users\Dan.Calver\AppData\Local\Red Gate\SQL Source Control 7\WorkingBases\gdl5kj1m.wzq</RootPath>
          </IWorkspaceId>
          <SharedModel>False</SharedModel>
          <ScriptTransientId version="1" type="WorkspaceId">
            <RootPath>C:\Users\Dan.Calver\AppData\Local\Red Gate\SQL Source Control 7\Transients\d4ojtks4.p2g</RootPath>
          </ScriptTransientId>
        </value>

    If you wish to start over, I would create a new local working folder and link that to your repository and then link the database to that new folder.

    Kind regards

    Dan Calver | Redgate Software
    Have you visited our 
    Help Center?

Sign In or Register to comment.