Unable to Paste a PAT from GitHub to Cloud9 Ruby on Rails - ruby-on-rails-3

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

Related

Able to authenticate with SSH with Github but somehow says "key is already in use"?

I have two ssh keys i've created, first one for my personal use and
the second one which I just created for work/school.
When I log into using git CLI using SSH with the second SSH key, it says
that i have successfully logged in like below
$ winpty gh auth login
? What account do you want to log into? GitHub.com
? You're already logged into github.com. Do you want to re-authenticate? Yes
? What is your preferred protocol for Git operations? SSH
? Upload your SSH public key to your GitHub account? C:\Users\dykim\.ssh\id_rsa.
pub
? Title for your SSH key: (GitHub CLI) second-key
? Title for your SSH key: future_proof
? How would you like to authenticate GitHub CLI? Login with a web browser
! First copy your one-time code: 0B1D-6370
Press Enter to open github.com in your browser...
✓ Authentication complete.
- gh config set -h github.com git_protocol ssh
✓ Configured git protocol
HTTP 422: Validation Failed (https://api.github.com/user/keys)
key is already in use
so somehow there isn't a problem to authenticating.
But I am worried that this will somehow pop up later and be a problem later when I am
working on my future projects for work.
What can I do to avoid this issue?
That seems similar to a pending reported issue #5299: "Spurious auth error when SSH key is already registered on account"
Steps to reproduce the behavior
Run gh auth login and select an SSH key that is already registered with the account
Get the above error, even though the key will work correctly
Expected vs actual behavior
I think there are a couple of ways that the handling of already registered keys could be improved:
Given the CLI app is granted full permission over the user's registered SSH keys, it could presumably list the already registered ones first and only attempt to register a new key if it wasn't already registered.
Then the error would only occur if the key was registered on a different account (or you uploaded it via the web browser while also attempting to register the CLI app, which would be an odd thing to do)
Customise the error message when this step fails to say something like "key already in use (Note: this error is expected if this SSH key was already registered on your account)"

Logon failed, use Ctrl + C to cancel basic credential prompt

I'm facing problems while trying to pull/push my code into a GitHub repository using the cmd prompt for the last two days. How can I resolve this issue?
Logon failed, use Ctrl + C to cancel basic credential prompt. Username for 'https://github.com': satyendrasingh8 Password for 'https://satyendrasingh8#github.com': remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/satyendrasingh8/chatApp.git/'
Fitz_Hoo is right! I just wanted to give a more detailed explanation that fix my issue. Essentially GitHub deprecated their password authentication recently (you can read more by clicking here).
Now instead of adding your username/email and password, you will login with your browser. The image below is the new interface. As Fitz_hoo mentions, you must update your Git to see the new changes!
If you are using Windows, you can simply use this command below to update your Git:
git update-git-for-windows
I fixed the problem just simply by upgrading my client Git Bash to the latest version!
When I encountered the problem, I received an email from a GitHub official, who told me the reason was mainly the Git version was incompatible:
GitHub has changed how users authenticate when using Git for Windows, and now requires the use of a web browser to authenticate to GitHub. To be able to login via web browser, users need to update to the latest version of Git for Windows. You can download the latest version at:
https://gitforwindows.org/
One reason for this message could be that the remote branch you were trying to pull was already deleted.
Delete the GitHub entry from Credential Manager: Control Panel → User Accounts → Credential Manager.
Then push the code again.
For me, the problem was that instead of my username I was trying to login with my email.
I received an email from GitHub telling me
We recently updated the format of our API authentication tokens,
providing additional security benefits to all our customers. In order
to benefit from this new format, please regenerate your personal
access token
I regenerated my personal access token (PAT) and was then unable to log in from command line on Windows 10 when I tried something like git pull.
A window would pop up, inviting me to enter 'username or email' and password. I tried various combinations, using the PAT, as mentioned in the GitHub documentation, and the actual password, but every time I received:
Logon failed, use ctrl+c to cancel basic credential prompt
Thanks to the answers from Fitz_Hoo and ousecTic, I updated my Git install with the command provided by ousecTic, and the authentication process was then completely different.
You can opt to use a PAT, but when you paste it in, no characters at all are shown, so just hit Enter.
In my case, I had this issue in relation to the federated authentication to AWS CodeCommit. The fix was to upgrade git to +v2.30.z (i.e. 2.35.3) and disable interactive prompt (docs):
git config --global credential.interactive false
A global configuration in ~/.gitconfig would look like:
[credential]
interactive = false
A AWS CodeCommit specific configuration, would look like (in ~/.gitconfig):
[credential "https://git-codecommit.us-east-1.amazonaws.com"]
interactive = false
here is the solution which works for me, uninstall Git from Machine after that install new version of it and sign in via web

ERROR: (gcloud.compute.ssh) Could not fetch resource: - Insufficient Permission

I am having trouble working through the Compute Engine Quickstart: Build a to-do app with a MongoDB tutorial. (edit: I am running the tutorial from within the compute engine console; i.e. https://console.cloud.google.com/compute/instances?project=&tutorial=compute_quickstart)
I SSH into the backend instance. I enter the "gcloud compute" command as copied from the tutorial. I am prompted to enter a passphrase. The following is returned:
WARNING: The public SSH key file for gcloud does not exist.
WARNING: The private SSH key file for gcloud does not exist.
WARNING: You do not have an SSH key for gcloud.
WARNING: SSH keygen will be executed to generate a key.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in
...
<< Identifying detail ommitted >>
...
**ERROR: (gcloud.compute.ssh) Could not fetch resource:
- Insufficient Permission**
I had run through this stage of the tutorial on a previous occasion with no problems.
I am working from a Windows 10 PC with the google-cloud-sdk installed. I am using google chrome. I have tried in both regular and incognito modes.
Any help or advice greatfully received!
DaveDub
It looks like the attempt to SSH is recognising the instance in your project, but the user doesn't have the required permissions to access the machine.
Have you tried running:
gcloud auth login
and completing the web-based authorization to ensure you are attempting to access the machine as the correct (authenticated) user? This process ensures the Cloud SDK you are running inherits the permissions of the user specified in the web-based authorisation. See here for more information on this.
It's also worth adding the link to the tutorial you are following to your question.
Besides the accepted answer, be sure you are in the correct gcloud project
gcloud projects list
Then
gcloud config set project <your-project>
I just ran into this for yet another reason. Google has always had poor handling of multi-user auth conflicts with their business products. Whatever you sign into a clean chrome session with 'first' gets a 'special', invisible role. I've noticed with gsuite that I get 'forced' into that first user when I try to access the admin panel, and the only way to escape is to make sure that whatever google user I use for the gsuite admin is 'first', or open an incognito window. I've seen this bug for years, can't believe it still exists.
Anyways, I ran into a similar issue. Somehow I was the wrong google user, so the link I got when copy/pasting out of 'connect with gcloud command' was implying wrong google user. Only noticed later when I just gave up and used the terminal that I was not my normal user... So, might look into that.

[Couchbase-server]Adding user/Changing password?

I am a newbie getting started with couchbase-server.
I simply want to browse the data present in a couchbase server using UI at http://www.dataoncouchbase.com:8091/index.html.
The password for the account "Administrator" is unknown. But I need to login to see the data.
One technique for changing the administrator password on couchbase-server is the following command (I do have access to the machine via command line)
$$ /opt/couchbase/bin/couchbase-cli cluster-init -u Administrator -p old_password -c 127.0.0.1:8091 --cluster-init-username=Administrator --cluster-init-password=new_password
BUT...only works if you know the old password(which I don't have).
I also tried modifying the local.ini file present at : /opt/couchbase/etc/couchdb/ and restarting the server. I added a new line(username=password) under [admins] section in the file. However I am not able to log in with the new user as well.
It would be great if someone can give me a way to add a new user(with read/write permissions) or change password for Administrator OR point me to some resource to do the same.
cbreset_password - it'll reset Administrator password w/o need to know the prior.
Have you looked in "config.dat" according to this it may appear there in plain text. (granted, they are talking about web console).
It seems like you may have already seen this but I'll reference it just in case. The format they use for password stored in local.ini includes spaces -> "username = password" Also they recommend running the command 'ls -alR /opt/couchbase-server/etc' to help figure out where your problem might be. Perhaps you can post your output for that command here if the last two suggestions don't work out.
I had the same problem. Seems like there's no way to reset the password, but it is visible in the config.dat file. The other thing that caught me out is the username...it's case sensitive, so Admin != admin !!!
If you know the old password ( I know this is not your case, but I want to write the solution to help someone who knows old password), you should read:
I changed with this command ( although it has thrown error --> ERROR: option cluster-init-ramsize is not specified);
./couchbase-cli cluster-init -c 127.0.0.1:8091 --user=admin --password=OLDPASS --cluster-init-username=admin --cluster-init-password=NEWPASS
My configuration is;
CentOs Gnu/Linux &
Couchbase 2.5.0
I have run command under the directory: /opt/couchbase/bin
Ok man I figured it out :)
I use OSX but I guess the way will be simular.
I went into the CouchbaseServer.app in orde to view the content.
then you open the folder Content/Resources/couchbase-core/bin
and theres programm called cbreset_password :)
Then it asked you to change the admin password.....there you go.
I feel with you it took me 2 hours :)
Using couchsync with couchbase you can change all users password using the administrative REST API.
curl -vX PUT http://127.0.0.1:4985/yourdbname/_user/youruser --data "{"name":"youruser", "password":"newpassword", "admin_channels":["yourlistofchannels"], "admin_roles":["yourlistofroles"]}"
Using your command go to your Couchbase bin folder. For mac, this is
/Applications/Couchbase Server.app/Contents/Resources/couchbase-core/bin
In that folder, execute this:
./couchbase-cli reset-admin-password --new-password test123.
Your new password will be changed to test123.
Here is the detailed guide: https://docs.couchbase.com/server/4.6/cli/cbcli/reset-admin-password.html
Step1:
/opt/couchbase/bin/couchbase-cli reset-admin-password --new-password 'Pass#2020'
-------
SUCCESS
-------
You may be trying to login with username "Administrator" but you will see error sometimes. Because in some clusters "Administrator" may not be the default hard coded admin, to see the admin name see the below file (as follows):
$ ls -lrth /opt/couchbase/var/lib/couchbase/isasl.pw
$ cp /opt/couchbase/var/lib/couchbase/isasl.pw /tmp
$ cat /tmp/isasl.pw
{
"users": [
{
"n": "**Admin**",
------------------here "Admin" is the Administrator account. So use "Admin" as username to login with your new password changed in step1.

How to save subversion password with bzr-svn

I am using bzr-svn to chekout svn repositories using bazaar. But bzr-svn asks for passwords everytime, I searched the web to find out about authentication.conf
I put the following section authentication.conf
[something]
scheme=svn+http #tried http only or svn only
host=uuuuuu.com
path=/svn/project #tried without stating path
user=wwwww
password='mmmmmm' #tried without quotes
In all cases either I was prompted for password, or got the following error
bzr: ERROR: Permission denied: ".": OPTIONS of 'http://xxxxxxxxx/': authorization failed: Could not authenticate to server: rejected Basic challenge (http://gamernetwork.unfuddle.com)
I put the same snippet in bazaar.conf and subversion.conf, but I got the same results/errors.
How can I use bzr-svn without typing my password each and every time?
I learned from #bzr IRC channel that bzr-svn can use cached authentication info of regular subversion client.
You just have to checkout the project once with svn, saving the user name and password. After that, bzr svn can use this password.