4

I'm new to SQLFluff and am interested in a pre-commit check of changed files for rule violations. SQLFluff is working correctly, and to get it working with pre-commit I'm following the guide found here, but am confused by pre-commit asking for git credentials before doing anything.

After entering a commit message, I see:

[INFO] Initializing environment for *my gitlab URL*

Username for '*my gitlab URL*':

My org does everything through SSO so I don't have the password to give. No guide or blog post detailing the set up of pre-commit (at least that I can find) shows or says anything about credentials or configuring authentication. Running pre-commit against a file using a terminal command yields the same result. From what I understand, the provided SQLFluff hooks are client side, so I don't know why authenticating to gitlab would be necessary. I feel like I am missing something obvious, but I've done my searching and came up short. Much thanks to anybody who can tell me what I'm missing!

Josh Olsen
  • 49
  • 3
  • please show your configuration -- I suspect you're not following the directions and instead incorrectly listing *your own repository* instead of the sqlfluff one – anthony sottile Oct 20 '21 at 20:44
  • You are absolutely correct, I had added my own git address on autopilot. Changing it to the proper URL got me a step further...now I'm investigating why .pre-commit-hooks.yaml is not being created. I've followed the steps listed on the official install page but no luck yet. – Josh Olsen Oct 20 '21 at 21:58
  • Looks like I needed to run ```pre-commit autoupdate``` to get that file. – Josh Olsen Oct 20 '21 at 22:01
  • Please provide enough code so others can better understand or reproduce the problem. – Community Oct 21 '21 at 07:14

1 Answers1

9

In my case when trying flake8 on pre-commit, I had same issue, my configuration file was trying to get the repo from gitlab. Changing that to github solved the issue. Hope that would help!

  • Thanks. That's weird that they have different implementation for Github and GitLab. – wowkin2 Nov 24 '22 at 16:00
  • 1
    Thank you, this solved it also for me. I found more explanation here: https://www.reddit.com/r/Python/comments/yvfww8/flake8_took_down_the_gitlab_repository_in_favor/ – shad Apr 20 '23 at 10:16