Cleaning up some personal projects and performing some maintenance on some personal deployments.
Tag: GitHub
-
git@github.com: Permission denied (publickey)
Issue:
ubuntu@rgvwebpro:~$ git push git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
Resolution:
The error message you’re seeing is typically related to SSH key authentication issues when trying to communicate with a GitHub repository. The steps to resolve this error and prevent it from occurring in the future are as follows:
- Check SSH Keys: Make sure that you have an SSH key generated and added to your GitHub account.
- To check if you have an SSH key, you can run the following command:
ls -al ~/.ssh
- If you don’t see any SSH keys, or if you want to create a new one, you can generate an SSH key using the command:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
- To check if you have an SSH key, you can run the following command:
- Add SSH Key to GitHub:
- Run
cat ~/.ssh/id_rsa.pub
to display your public SSH key. - Copy the displayed key.
- Go to your GitHub account settings, navigate to the SSH and GPG keys section, click on “New SSH key”, paste your public key into the text field, and save it.
- Run
- Check SSH Agent:
- Ensure that the ssh-agent is running by executing
eval "$(ssh-agent -s)"
. - Add your private SSH key to the ssh-agent using the command:
ssh-add ~/.ssh/id_rsa
- Ensure that the ssh-agent is running by executing
- Test the Connection:
- Test your SSH connection to GitHub using the following command:
ssh -T git@github.com
- You should receive a message indicating that you’ve successfully authenticated, but that GitHub does not provide shell access.
- Test your SSH connection to GitHub using the following command:
- Update Remote URL (Optional):
- If your repository is still configured to use HTTPS, you might want to switch to SSH. You can check the remote URL using:
git remote -v
- If needed, change the remote URL to use the SSH protocol:
git remote set-url origin git@github.com:username/repo.git
- If your repository is still configured to use HTTPS, you might want to switch to SSH. You can check the remote URL using:
- Retry the Push:
- Now try pushing to GitHub again:
git push
- Now try pushing to GitHub again:
- Check Repository Permissions:
- Ensure that your GitHub account has the necessary permissions to access the repository you’re trying to push to.
By following these steps, you should be able to resolve the “Permission denied (publickey)” error when pushing to GitHub.
- Check SSH Keys: Make sure that you have an SSH key generated and added to your GitHub account.
-
Going to try Copilot chat
This is… nice.
-
Example GitHub PHP Project
As a former independent web developer, I had very little use for GitHub as my project base consisted of small business owners and their requirements mostly never got past having a WordPress website and business email setup.
Today, using Git repos are vital for my workflow as I’ve been working with various teams to push web apps to live status. Now, I can’t picture not using Git repos for any project. After being a largely siloed developer, my work is now part of a very collaborative process.
With that said, I’ve been working on a personal project, jsldvr/example.com, which is a PHP web app that is supposed to make developing a website as easy as possible for those that use cPanel or AWS. The app is more of an exercise in learning how to use GitHub, and building a secure PHP app from scratch.
I don’t have a road map with this project. I simply want to have fun with it and learn as much as I can about collaborating and/or developing on GitHub.