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
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"
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
Error-2: (e.g git pull...) before pushing again
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
or
If you've already pushed your code to the GitHub repo more than once.
git push -f
Error-3 : src refspec main does not match any
Solution-1
Step 1: Go to GitHub Settings and then go to Emails
Step-2: Uncheck Keep my email addresses private
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
Error 4: Requested URL returned error: 403
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
Step-2: Open a new repository in your GitHub
Step-3: Copy your repository link
Step-4: Go to the terminal and write the following command:
git remote set-url origin your-repo-link
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
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".
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)