The business scenario
I originally created a Repository on Github, called Github_test, and Uploaded some files. But in a few years, I want to use the Repository again, update and upload files.
I clone the Repository on a virtual machine, modify and add some files, and want to update to Github.
Here’s how I did it
I created the public and private keys using SSH-Keygen,
The public key
The cat ~ /. SSH/id_rsa. Pub
To submit to Github, here are the steps
But I encountered the following error on Git Push:
git push
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/taoyunxing/github_test/info/refs
fatal: HTTP request failed
The solution
vim .git/config
Modify the
[remote “origin”]
url =
https://github.com/taoyunxing/github_test
To:
[remote “origin”]
url =
https://[email protected]/taoyunxing/github_test
Git push again, enter the password for the entire Github account in the pop-up box, and you can commit
conclusion
Here’s a hint:
Any repository I have on Github, and if I want to commit code on some new terminal machine and I forget about the public key, I can generate a pair of public and private keys locally, upload the public key to the repository, and happily push git code.
reference
[1].
http://blog.csdn.net/happyteafriends/article/details/11554043
Read More:
- GitHub push ErrorThe requested URL returned error: 403 Forbidden while accessing
- Solving GitHub push error: the requested URL returned error:403 Forbidden while accessing
- Solve github :error: failed to push some refs to problem
- GitHub upload failed: git push error: failed to push some refs to exception handling
- Android studio push project to GitHub
- Push failed Unable to access ‘https://github.com/‘: Failed to connect to github.com port 443: Timed
- [Git & GitHub] Solution: error: failed to push some refs to’https://github.com/xxxx.git’
- 404 error in accessing GitHub personal blog
- Gitpod cannot push to GitHub solution
- How to solve error: failed to push some refs to ‘[email protected]:……git pull conflict
- Git failed to submit data error: failed to push some refs to’https://github.com/XXXXXXX/gif.git’
- error: src refspec master does not match any error:failed to push some refs to ‘[email protected]:xxxx
- How to Solve Error: The requested URL returned error: 401 Unauthorized while accessing
- git push error failed to push some refs to solution
- To solve the problem of nginx accessing PHP file into download
- The solution of push D command execution error (/ bin / sh: 1: push D: not found) on Ubuntu
- Git push “fatal: Authentication failed ”
- fatal: unable to access ‘https://github.com/xxx‘: Failed to connect to github.com
- Linux Tomcat accessing files on the server