Git Hub Using SSH
1. Use Personal Access Tokens (PAT)
You can create a Personal Access Token in GitHub and use it instead of your password. Here's how:
-
Generate a Personal Access Token:
- Go to your GitHub account settings.
- Navigate to Developer settings > Personal access tokens > Tokens (classic).
- Click on Generate new token.
- Select the scopes/permissions you need (for repository access, select repo).
- Click Generate token and make sure to copy the token (you won’t be able to see it again).
-
Use the Token for Authentication: When prompted for a username and password in the terminal:
- Use your GitHub username as the username.
- Use the generated token as the password.
2. Use SSH Authentication
Alternatively, you can use SSH keys for authentication. Here’s how to set it up:
-
Generate an SSH Key (if you don’t have one):
bashssh-keygen -t rsa -b 4096 -C "cto@issentialsolutions.com"
Follow the prompts to save the key (usually in ~/.ssh/id_rsa).
-
Add the SSH Key to your GitHub Account:
- Copy the SSH key to your clipboard:
bash
cat ~/.ssh/id_rsa.pub
- Go to GitHub settings > SSH and GPG keys > New SSH key.
- Paste the key and give it a title.
- Copy the SSH key to your clipboard:
-
Clone the Repository Using SSH: Change the repository URL to use SSH:
bashgit clone git@github.com:krishnaaka-online/is-odoo.git
To See the private Key
cat ~/.ssh/id_rsa
Summary
Choose either Personal Access Tokens or SSH authentication to resolve the authentication issue. If you frequently use GitHub, SSH is often more convenient, while PATs are simpler for one-off uses.