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:
- Android studio push project to GitHub
- error: src refspec master does not match any error:failed to push some refs to ‘[email protected]:xxxx
- Git uploads local IntelliJ idea project to GitHub
- GitHub push ErrorThe requested URL returned error: 403 Forbidden while accessing
- push failed The requested URL returned error: 403
- git push error failed to push some refs to solution
- Git failed to submit data error: failed to push some refs to’https://github.com/XXXXXXX/gif.git’
- Solving GitHub push error: the requested URL returned error:403 Forbidden while accessing
- GitHub desktop upload file error commit failed – exit code 1 received
- [Git & GitHub] Solution: error: failed to push some refs to’https://github.com/xxxx.git’
- Git push “fatal: Authentication failed ”
- Push failed Unable to access ‘https://github.com/‘: Failed to connect to github.com port 443: Timed
- Error: SRC refspec master does not match any. error: failed to push some refs to
- [FAQ] after git merge, the push to Gerrit fails, indicating no new changes?
- Failed to push some refs to
- Solve github :error: failed to push some refs to problem
- Git push you are not allowed to upload merges
- Problem solving: failed to connect to github.com port 443: Operation timed out(2020.06.04)