DEV Community

Cover image for Solutions To Some Common GitHub issues
Shafia Rahman Chowdhury
Shafia Rahman Chowdhury

Posted on • Updated on

Solutions To Some Common GitHub issues

Sometimes, you may come across various challenges when using GitHub. In this blog post, we will explore some common issues we encounter and provide practical solutions to help you overcome them. Let's dive in!

Error-1: Git Configuration error

Image description

Solution

Step 1: The image shows two commands in the terminal. If you receive these commands, execute them one by one in your terminal.

git config --global user.email "your github email"
git config --global user.name "your github name"
Enter fullscreen mode Exit fullscreen mode

Step-2: A pop-up with sign in with browser will appear. Make sure you are logged in your GitHub Account. Click on the
sign in with browser and then click Authorize Visual Studio Code button

Step 3: Go to your terminal again and run these commands

git branch -M main
git remote add origin "your repo link"
git push -u origin main 

Enter fullscreen mode Exit fullscreen mode

Error-2: (e.g git pull...) before pushing again

Image description

Solution

If you're submitting your code to GitHub for the first time, open your terminal again and run these commands:

git push -u origin main -f
Enter fullscreen mode Exit fullscreen mode

or

If you've already pushed your code to the GitHub repo more than once.

git push -f
Enter fullscreen mode Exit fullscreen mode

Error-3 : src refspec main does not match any

Image description

Solution-1

Step 1: Go to GitHub Settings and then go to Emails

Step-2: Uncheck Keep my email addresses private

Image description

Step-3: Push your code again

Solution-2

Open your Git bash terminal and run the following commands one by one:

rm -rf .git
git init
git add .
git commit -m "added"
git branch -M main
git remote add origin <YOUR_GITHUB_REPO_LINK>
git push -u origin main -f
Enter fullscreen mode Exit fullscreen mode

Error 4: Requested URL returned error: 403

Image description

This error takes place when you do not have access to a repository.

Solution-1

Step-1: Check if you are pushing the code to your repository

git remote -v
Enter fullscreen mode Exit fullscreen mode

Step-2: Open a new repository in your GitHub

Image description

Step-3: Copy your repository link

Image description

Step-4: Go to the terminal and write the following command:

git remote set-url origin your-repo-link
Enter fullscreen mode Exit fullscreen mode

After the entering command, check if the git repository url changed. Write git remote -v on your terminal.

Step-5: Then, run these commands one by one

git branch -M main
git push -u origin main
Enter fullscreen mode Exit fullscreen mode

Solution-2

https://dev.to/shafia/requested-url-returned-error-403-1pfm

Follow the solutions discussed above and get rid off your errors.

Visit the link below and learn how to resolve the GitHub error "Support for password authentication was removed".

https://dev.to/shafia/support-for-password-authentication-was-removed-please-use-a-personal-access-token-instead-4nbk

Don't let these common issues discourage you. Keep exploring, collaborating, and contributing on GitHub, and watch your skills grow. Happy coding!

Top comments (0)