I am running gerrit on dockers successfully until now. The next step I want to achieve is is as follows:
I have a service running and if the the service passes I want to to review the code as +1 and 0 if it fails. But to review code I need a user, for this I need to create a user account once the gerrit instance is launched, then add this user to the reviewer list for that project, then make this user review the code based on whether the service passes or not.
I am able to review the code using the below command:
ssh -p 29418 host_ip gerrit review --code-review +2 commit_id
But I'm not able to create a user and add the user to the list of reviewers for that project. I am not getting any errors but am not able to find out whether the command worked or not as I'm not able to find any new users added. I used the below command:
cat ~/.ssh/id_watcher.pub | ssh -p 29418 host_ip gerrit create-account --ssh-key - watcher
My gerrit instance is LDAP configured. Am I going in the right direction? What am I doing wrong?
Related
I am trying to paste a Personal Access Token that I created in GitHub into the command line of a Ruby on Rails program I'm developing on Cloud9. I put in my GitHub username, and when I try to put in the PAT under password, it won't paste. I've tried with 2 different apps, but can't complete the git push. As a result I can't deploy my app to production.
I'm new at RnR, so have been learning using https://www.railstutorial.org/ following these instructions. I would appreciate any help I could get.
[website (main)]$ git remote add origin https://github.com/mhartl/hello_app.git
[website (main)]$ git branch -M main
[website (main)]$ git push -u origin main
After running the third command you will be prompted to enter your username and password. The username is simply your GitHub username, but the password is not your GitHub password; instead, the “password” must be a personal access token which you can create by following the instructions in the GitHub article “Creating a personal access token” I suggest selecting “No expiration” for the token expiration, and also be sure to select “repo” as the scope of the token so that it works at the command line. Once you’ve created and saved the personal access token, paste it in at the command line when prompted for a password to complete the git push
Check if it actually won't paste, meaning: when you paste a password, often it is not displayed at all: you get the impression the paste failed because nothing moved.
But do try, just after pasting, to click enter and the PAT should be taken into account, even if it remains "invisible".
Check also your git config --global credential.helper: a caching mechanism can help you not entering the PAT on each clone/push/pull operation.
At least, for instance, git config --global credential.helper "cache --timeout=86400"
You can see what is cached with:
printf "host=github.com\nprotocol=https"|git-credential-cache get
You can remove it with
printf "host=github.com\nprotocol=https\nusername=you"|git-credential-cache erase
You can store the new PAT with
printf "host=github.com\nprotocol=https\nusername=you\npassword=yourPAT"|git-credential-cache store
I have tried google it and check the gitlab-documentation but did not find a good answer for this.
When I setup GitLab I am advised to test my SSH-keys to my GitLab URL instance.
I use git#gitlab.com.
What actually happens when I run "ssh git#gitlab.com"
I understand how you use SSH to login to a remote device e.g. Cisco Router with SSH Admin. But in this case: who is git#gitlab.com? [username]#gitlab.com makes more sense to me.
Somehow it must find my Gitlab account (since it is there my public key is stored). How can I do that when I use a generic git#gitlab.com ?
I am after a more step-by-step answer (Client-Server)
[username]#gitlab.com makes more sense to me
It would not: that would ask to open an SSH session as 'username': that account does not exist. Only one account exists: 'git'.
Then, in ~/.ssh/authrorized_keys, your public key is found, alongside:
an ID (as shown here), matching your registered GitLab account,
a forced command, which will call a GitLab script in order to execute the Git command.
That way:
there is no interractive session possible on GitLab's server
the project gitlab-shell gets your ID and hangle your Git query
for found it, go in repository on clone, select ssh, begin start copy up to :,
now test
I need to use Trac for project management, but I am having problems with authentication. I don't have Apache, I'm using nginx and the tracd server.
To create the user, I used the command:
htpasswd -c /home/ubuntu/trac/projeto/.htpasswd usuario
To upload the service I'm using the following command:
/home/ubuntu/trac/virtualvenv/bin/tracd -p 3050 --basic-auth="/home/ubuntu/trac/projeto,/home/ubuntu/trac/projeto/.htpasswd," /home/ubuntu/trac/projeto
When I call the project in the browser, the login window is presented to me, which always fails, even informing the user and the correct password.
what am I doing wrong?
Try: --basic-auth="projeto,/home/ubuntu/trac/projeto/.htpasswd,trac". See TracStandalone for details.
I created an application on existent OpenShift project by pulling a docker image from remote repo.
The pod is created but fails with STATUS "Crash Loop Back-off".
Invesitgating the reason using
oc log <pod id> -p
it appears a list of unsuccessfull "chown: changing ownership of '...': Operation not permitted
I found this is due to non predictable user id running the container.
According to
https://docs.openshift.com/container-platform/3.6/admin_guide/manage_scc.html and various post here and there,
it seems the solution is to relax security policy:
oc login -u system:admin https://<remote openshift endpoint>
oadm policy add-scc-to-group anyuid system:authenticated
If this is the solution, I don't know, because I cannot get out of 1st problem:
oc login -u system:admin
asks for login/pwd and after print an error
error: username system:admin is invalid for basic auth
I guess there is the need of a certificate, a token, something secure, but I cannot understand how to generate it from Openshift, or
if there was a key pair to generate locally (of which kind) and how to bind the key to the user. Furthermore, checking in the web console
I cannot see that kind of user (system:admin).
Am I missing something?
Thanks a lot,
Lorenzo
I've been trying to add users as reviewers to changes. I've stumbled upon a strange issue. If I identify users by their username, everything goes smoothly. If I identify them by email, Gerrit complains.
what works:
ssh -p 29418 user#review.example.com gerrit set-reviewers --add username changeid
what doesn't work:
ssh -p 29418 user#review.example.com gerrit set-reviewers --add username#example.com changeid
The user has username as their user name and username#example.com as their email address.
What Gerrit responds with is:
error: could not add username#example com: username#example.com does not identify a registered user or group
Resolved it myself, peeking in the source code helped.
The SSH command set-reviewers is handled by a class named PostReviewers. This delegates to AccountsCollection to parse the reviewer and turn it into an account id. This is where the problem is - I have two users identified by the same email address, so AccountsCollection#_parse(String) returns nothing.
Why two accounts with the same email? I've got multiple instances of Gerrit I work with, I log in via OpenID, and on one environment I need to see my changes from the "parent" environment. That's where a small hack in the database was applied and everything worked. Until now :)