pre-commit authenticating to gitlab - gitlab

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!

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!

Related

Appcenter pipeline was working fine, but now not building

My pipeline on appcenter was working fine.
Now I tried to do a push, but is failing with:
##[command]git fetch --tags --prune --progress --no-recurse-submodules origin
remote: Invalid username or password
fatal: Authentication failed for 'https://***:***#bitbucket.org/company/react-native-proj.git/'
##[error]Git fetch failed with exit code: 128
how to fix this?
I have checked and says I have to check for disabled web hooks
https://learn.microsoft.com/en-us/appcenter/build/troubleshooting/code-repos#im-connected-to-bitbucket-and-my-builds-fail-with-git-error
but I have no "disabled" web hooks on bitbucket?
How to fix it? what was the cause?
Thanks!
For anyone having the same issue between App Center and your Devops repo, simply resave your build configuration on App Center and the issue should correct itself.
Taking the #ManuelBetancurt's comment.
You need to disable distribution option and build.
Then you can enable option and build, it will work again.
For anyone having the same issue between App Center and your Devops repo, simply resave your build configuration on App Center and the issue should correct itself.
It helps for 3-4 hours and then this situation again. Fix with distribution button will help
The problem was an internal bug on appcenter.
After a couple of days chatting with the customer support, it is resolved.
The problem was fixed temporarily by disabling distribution, and just doing build. Then doing the distribution manually...

How to restore default gitlab page?

I mistakenly removed default gitlab page (type of user.gitlab.io/project)
How can I restore this?
Thanks you in advance.
Is it possible at all?
Brief Version:
Delete repo, repush and wait.
Detailed Version:
Keep the repo in your local,
Delete repo on gitlab (which will cause losing MR history, but that's not critical for me at least),
Create new Repo (no matter it's same name or not)
Push the code
Then I deleted .gitlab-ci.yml as a commit and added it back as another commit, so that you will see "Congratulations! Your pages are served under: https://username.gitlab.io/project-name" in Gitlab Page Setting, (I am not sure this step is required or not, if I am wrong please correct me, it just automatically worked)
Then you might still get "404 The page you're looking for could not be found." from that link, what you need to do is just WAIT. For me it's about 3 hours (while I am frustrated to looking for other solution, it just worked at some point)
Some explain:
I did step 5 because: it seems gitlab is always automatically enable the default gitlab page once it finds an .gitlab-ci.yml file in your repo.

gitlab clone fails with could not read from remote repository

While trying to clone a repository from gitlab, I ran into the following error:
git clone <USER>#<URL>:<path_to_project.git>
Cloning into 'xxx'...
<USER>#<URL>'s password:
fatal: 'root/acl-labl-website.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I tried both the SSL and HTTP address, and both got this similar error. Not sure what it meant, and after many tries involving modifying config files (from gitlab, nginx, apache checking redirects, etc.), I found the very simple answer. Still not sure why my other method didn't work, but I found that first adding your public ssh key to gitlab (through the GUI), then using the same command as above, but using git instead of my username:
git clone git#<URL>:<repo_path>.git
worked. I.e. generate your id_rsa.pub as explained here: https://docs.gitlab.com/ce/ssh/README.html , copy this to your ssh keys (which in my case was one of the tabs in the gitlab GUI; I've done this before for git as well, where it's also to be found somewhere in your user settings). In my case I had to run
ssh-add
still before it worked, but with a colleague it worked without as well.
Then the cloning using git# instead of username# worked perfectly. Again; still not sure why it won't work using my username and password (same as the one I use to login to the gitlab GUI), so if someone could shed some light on that, I'd be interested in it. But since it took my quite some time before I found this solution/work-around, thought I'd post it here. Perhaps better suited to serverfault actually, but since I suspect many people end up here as well, perhaps the admins can live with this post here :)

how to solve git push fails with two-step authentication (linux)

I'm trying to push some edits from personal proyect to my repository and requires me my username and pass, i write them but the console show me something like:
fatal: authentication failed
I didn't make any mistake writing my username and pass, so I tried to figure out and I think this is for the two-step authentication that i have on my github account. Someone knows how to solve that?, I'll be glad.
Like #NickStoughton mentioned in the comments, SSH is probably the best way to do this.
Here is the fixed version of his link:
https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

Auto Deployment with Git

Ok, I am trying to auto deploy my node.js application with git.
This is what I have on my server:
/home/git/myproj.git - bare repo
/home/me/public_html - cloned repo of the aforementioned bare repo
Now the problem is, I cannot pull from myproj.git/hooks/post-receive because the push to the repo is made as the git user so I have permissions problem. I have also tried some deployment scripts but I have been facing a lot of permissions issues.
I have heard of tools like capistrano, fabric, gitolite, but I guess it's too complex for me atm, and I want something easier (very easy to setup, and keep on replicating in multiple projects).
I hope I made myself clear. I think this problem is related - Auto deployment PHP script using Gitolite - but I am not using gitolite and his answer doesn't make sense to me (probably because his English is not too well).
I first started with git and post-recieve hooks myself but didn't really like them. I then switched to a very simple bash script. Even if you don't use the script it's only like 200 lines in total so it's great to steal some snippets from.

Resources