-
Notifications
You must be signed in to change notification settings - Fork 0
Accessing Private Repos using SSH
Sahaj Rana edited this page Dec 28, 2023
·
2 revisions
- If using Windows, open Git Bash, or if using macOS or Linux open the terminal.
- To generate keys, paste the below test, substituting in your GitHub email address.
$ ssh-keygen -t ed25519 -C "[email protected]"
- At the prompt, hit Enter
> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]
This will generate the public & private Keys for SSH authentication.
- Start the ssh-agent
$ eval "$(ssh-agent -s)"
> Agent pid 59566
- Add your SSH private key to the ssh-agent
$ ssh-add ~/.ssh/id_ed25519
-
Open ~/.ssh/id_ed25519.pub file & copy the contents of a file.
-
Open the Github profile on the web, and go to Settings>SSH and GPG keys.
-
Click the New SSH key or Add SSH key.
- In the "Title" field, add a descriptive label for the new key. For example, if you're using a personal laptop, you might call this key "Personal laptop".
- Paste your key into the "Key" field.
- Click Add SSH key.
- If prompted, confirm access to your account on GitHub.
- If using Windows, open Git Bash, or if using macOS or Linux open the terminal & enter the following:
$ ssh -T [email protected]
# Attempts to ssh to GitHub
You may see a warning like this:
> The authenticity of host 'github.com (IP ADDRESS)' can't be established.
> RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
> Are you sure you want to continue connecting (yes/no)?
- Verify the fingerprint by typing yes. It will prompt like
Hi USERNAME! You've successfully authenticated, but GitHub does not provide shell access.
If Adding ssh keys with ssh-add
does not work. Follow the below 3rd procedure.
- Then add the created private-key in
ssh_config
file. It is located inC:\Program Files\Git\etc\ssh\ssh_config
...
Host github.com
Hostname github.com
IdentityFile ~/.ssh/my_ssh_key
Ready to make commits in private repos. Happy Coding!!
If not working, Retry or connect with experts.
© 2023 Blupx Private Limited All rights reserved.
- [https://github.com/BlupGithub/custom_widgets](Custom Widgets)