Gitlab project bot commit author as an authenticated user - gitlab

I'm trying to set up a self-hosted Gitlab project with renovate to automatically create merge requests for dependency updates.
I created a Gitlab project token/bot with the name "renovate" which resolves to "project_123_bot". The rub is that my project uses push rules to "Check whether the commit author is a GitLab user". I do not know what I should use as the git commit author for renovate-generated commits. I've tried:
Renovate Bot <renovate#gitlab.myorg.com>
Renovate Bot <project_123_bot>
Renovate Bot <project_123_bot#gitlab.myorg.com>
among others, and I always get this rejection when pushing:
remote: GitLab: Author 'project_123_bot#gitlab.myorg.com' is not a member of team
What is the appropriate git commit author to use for project bots? Is it not possible for project bots to commit changes as a verified authenticated user?

The correct email seems to be project123_bot#example.com. I need to look into where the example.com comes from.
Edit: "example.com" is hard-coded, see https://gitlab.com/gitlab-org/gitlab/-/issues/292668

Related

Enabling pre-receive server hook to get PR/MR approval before pushing to dev branch

Use case: I have code on my local machine and If I try to push it to remote server, a pre-receive hook in remote [GitLab] server should get triggered and ask for respective author approval to merge that code onto Gitlab repo.
After [code review] if author approves MR then code from my local repo will be pushed to remote server else push needs to be halted.
I am sure that I was asked to enable pre-receive hook on GitLab server side and not on client side.
I think it is not possible because code exists in developer's local machine and hence approver may not be able to do code review but not sure about pre-receive working.
Can pre-receive hook able to notify approver before code push? If it is possible need to know how?
If not, I want a strong valid point to negotiate😒
MR approval is not requested when one pushed a branch, but only when one makes (once the branch is pushed) a merge request to the target branch.
In your case:
protect the dev branch (nobody can push directly to it, so no need for a pre-receive hook)
make a merge request mandatory for that branch
make sure to configure your merge requests so that they must be approved before they can be merged.
That means any code eventually merged to dev:
will not have been pushed directly to dev (MR required)
will have been reviewed and approved first, before being accepted and merged to dev.
While it is true enforcing the MR approval process, meaning disabling the "Merge" button as long as approval is not met, is not free (premium only), you still have a way to enforce it.
Make sure nobody can push/merge to dev is a "Merge Manager" who is alone responsible to merge or not the MRs. If said merge manager sees there is no approval, they won't merge the MR.

GIT uploads - Linux username shows instead of git username

I am using 2 different GitHub accounts to manage 2 different projects. My device is a Pixelbook using the Linux beta terminal for pushing commits. I have the two accounts set up using SSH keys, and there doesn't seem to be a problem there.
When I initially set up the Linux, I set the username as "My-username", which is coincidentally the same username as my GitHub A-account. I looked at the repos on the Github B-account and saw my Linux/A-account listed as the author. The link to the profile is the correct account (as in the link is for github.com/B-Account).
How can I either
A: change the Linux username to something less identifiable
or
B: (preferred) change the author for new commits.
I have seen a few questions on here saying I can change the author with a script or amend command... but I don't think I really care about the existing commits. I just want to make it show the actual GitHub account name as the author instead of my terminal name.
Edit:
The git config --global user.name command shows my full name, and the email is set in the --local for each repo with the appropriate email to the associated account.
I was able to find a solution to my problem!
inside of the .git/config file, I removed the credential.helper = store line that I had previously enabled while using HTTPS connections.
Now my commits are posting with the appropriate account!

I can't finish the GitHub sharing process

There's an error while trying to push a project to GitHub. The Setting of "Keep my email address private" is checked, and the "Block command line pushes that expose my email" is checked. What's the solution?
I successfully created the project 'MyActivity' on GitHub, but the initial push failed:
remote: error: GH007: Your push would publish a private email address.
Event log screenshot
You need to set an email address for Git to use. Use your GitHub-provided email. For example, git config --global 2333223+username#users.noreply.github.com. You can find that in your email settings page.
After setting the email in Git, delete the already-created project on Git, and start the sharing process again.

github notification to nodeJS when master get a commit

Is it possible if my master branch in my github repo gets an update that my nodeJS server got a notification ? so i can do stuff with it ? like get the version tag and commit message ?
First you need to go to your repo, and click through this sequence:
Settings -> Webhooks & Services -> Add webhook
Then paste the url where github will submit data for each new commit. You can find examples of payload in example.
Then implement the logic needed in the backend to work with info about new commits.

Need github repo commit list without based upon user

Im trying to get the commit list from GitHub repo using its API.
I am getting the commit list but its based upon particular user.
I need the list based upon the commit happened.
Below is the url I am using:
https://api.github.com/repos/user_name_here/repo_name_here/commits?access_token=XXXXXXXXXXX&per_page=5
It seems that the commits returns by the API will list all the commits from a particular repo, for all authors (ie not based on a user).
See for instance the commits of GitLabhq repo:
https://api.github.com/repos/gitlabhq/gitlabhq/commits
You will get all commits, without restriction. You will get both the original author and committer name as well.

Resources