Using same SSH Key for both Bitbucket and Github - github

I'm using same email address on both platforms. Please let me know if it's possible, if not please guide me to best practice.
Thanks in advance.
I have successfully added the key to Bitbucket, all good here. When I tried to login GitHub via CLI (using gh auth login), I have faced this text:
HTTP 422: Validation Failed (https://api.github.com/user/keys)
key is already in use

While using a dedicated key pair for Github is the best practice, you can also use gh auth login with HTTPS and as a password a GitHub PAT (Personal Access Token, typically, a classic one, scope repos)
echo ghp_xxx | auth login -p https --with-toke
gh auth status and gh auth token will confirm you are correctly logged in to GitHub, with the right identity.

Related

Can't mirror gitlab repo to github

I've tried inputting:
https://<username>#github.com/<username>/<repo> + access token
https://<username>#github.com/<username>/<repo> + password
https://#github.com/<username>/<repo> + access token
https://#github.com/<username>/<repo> + password
ssh://<user>:github.com/<username>/<repo>
But none of them result in a successful update.
I have no clue what the issue could be, can someone explain step by step how to do this?
I have watched and read several tutorials but none have been able to get this to work.
Notes
The repo is public
Mirroring a GitLab repository would work with an authentication method which would be:
Public key authentication for SSH URL, using a GitHub deploy key registered to the target repository.
Make sure the URL is:
ssh://git#github.com/<username>/<repo>
^^^^
It is ssh://git#github.com/..., not ssh://<user>:github.com/
Or: password for HTTPS URL, except that password is, for GitHub repository, a PAT (Personal Access Token).
The URL would be:
https://github.com/<username>/<repo>
No need to add <username>, since your PAT will authenticate you anyway.

I'm unable to run github cli commands because I keep running into an Authentication Error. I'm using the correct username and password. Details below

I'm following the steps listed here to try and link an existing local project to a new repo on GitHub.
I ran gh repo create but got an Authentication error, with a note to update my credentials in the .gitsomeconfig file. I ran gh configure and entered my GitHub username and my GitHub password (since I chose that option instead of using an authentication token). I entered them exactly the same as I type them in. Then I ran gh repo create again and still ran into the Authentication error. I output the content of .gitsomeconfig and verified that the user_login is correct (It doesn't display my password anywhere).
I've tried running gh configureat least 6 times now. I've copied and pasted from Lastpass to be extra sure I'm entering credentials correctly. I've tried both my username and my email address since I wasn't sure which gh configure actually wanted for username, but neither seem to work. I'm at a loss for what might be going wrong. Any thoughts or suggestions?
The right command is gh auth login, using your GitHub account name and your GitHub token (not password, your PAT: Personal Access Token, with scopes "admin:org, gist, repo, user, workflow")
Then you can check with gh auth status.
Once the status is clean (authenticated), you can proceed with other commands, like gh repo create.

Use token to push some code to GitHub - "Support for password authentication was removed" [duplicate]

This question already has answers here:
Message "Support for password authentication was removed. Please use a personal access token instead."
(47 answers)
Closed 1 year ago.
Error message when using git push:
Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: unable to access 'https://github.com/codingTheWorld777/react-mini-projects.git/': The requested URL returned error: 403"***
I cannot use my token to access GitHub, so how can I push code to GitHub?
GitHub announced their intent to require the use of token-based authentication for all authenticated Git operations. They will no longer accept account passwords when authenticating Git operations on GitHub.com:
Generate token:
Go to your GitHub account token settings
Generate a token
On Mac:
Go to keychain Access
Press the Login tab and all items
Click GitHub key
Change the password to the recent generated token
On Windows:
Go to Control Panel → User Accounts → Credential Manager
Edit the Generic Credential of GitHub
Paste the token instead of the password
You need to change the remote URL with:
git remote set-url <stream> https://<token>#github.com/<username>/<repo>
token can be found here.
I also encounter this problem today, on macOS.
I solve this problem by:
First, get a token! Follow the guidance of GitHub. I think you can just click the link provided in the warning.
Second, change the key chain on macOS:
Search "Keychain" on macOS.
Search "GitHub".
Change the password in the one that with "Internet Password", using your new token.
Then, my problem is solved and I can "git push" now.
Step 1: Go to your GitHub account → Settings → Developer settings → Personal access tokens → Generate / regenerate your token
Step 2: Go to https://cli.github.com and download GitHub CLI
Step 3: Go to your command line or Terminal → gh auth login and follow with login credentials. Done.
I have the same problem. For me the solution was install the GitHub CLI in https://cli.github.com/. After installing in my OS, I ran gh auth login in my terminal and logged in through the browser with the access token that I generated in the GitHub profile. Follow:
My Account → Settings → Developer settings → Personal access tokens [GENERATE NEW TOKEN]
First of all, you need to create a personal access token in Creating a personal access token
git clone https://github.com/username/repo.git
Username: your_username
Password: your_token
Solution for Mac:
First generate a token from GitHub. And replace your password with the token from the keychain access in the GitHub section.
You need to create a personal access token. You can find the instructions on creating personal access token in Creating a personal access token
Make sure you keep the access token secure & secret. After that you need to replace your current saved password in the device (laptop/desktop) with the access token. In macOS you can search for Keychain and find GitHub with an Internet password and replace it with your access token. For instructions, see Updating credentials from the macOS Keychain.
In Windows, it might be Credential Manager (I'm not sure). Check this out: How to update your Git credentials on Windows

Github 2FA won't let me push to branch

Just added 2FA for Github but now when I go to push changes from the terminal to a branch and I try to authenticate myself with username + password I get rejected because there's nowhere to input my 2FA code...I know my username and password are correct because I can login to the site (with 2FA code). Terminal doesn't provide a space to input that code. How are others working around this?
You'll need a personal access token or SSH key.
The details are here: Accessing GitHub using two-factor authentication - Using two-factor authentication with the command line

Link Github to Namecheap: Validation failed

I am trying to link my Github account to my Namecheap account so I can use a custom domain for my Github page, but when I try to login this happens:
A few notes that might be handy:
I use 2 factor authentication on GH
I tried using my regular password but it told me to use my 2FA OTP code
I generated a personal token on GH and used that instead of my password to login (which produced the error)
Any help would be much appreciated!
I chatted with the helpdesk and he said that you have to create the cname record pointing to your github account manually.
http://davidensinger.com/2013/03/setting-the-dns-for-github-pages-on-namecheap/