生成ssh key
ssh-keygen -t rsa -C "mag@126.com" -f github.ssh
*** Please tell me who you are.
root@ubuntu:/home/ubuntu/test/mini-riscv-os# git add . root@ubuntu:/home/ubuntu/test/mini-riscv-os# git commit -m "my mini-riscv-os" *** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: unable to auto-detect email address (got 'root@ubuntu.(none)') root@ubuntu:/home/ubuntu/test/mini-riscv-os# git config --global user.name "mag" root@ubuntu:/home/ubuntu/test/mini-riscv-os# git commit -m "my mini-riscv-os" *** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: unable to auto-detect email address (got 'root@ubuntu.(none)') root@ubuntu:/home/ubuntu/test/mini-riscv-os# git config --global user.email "mag@126.com" root@ubuntu:/home/ubuntu/test/mini-riscv-os# git commit -m "my mini-riscv-os" [master (root-commit) a7b0d18] my mini-riscv-os 215 files changed, 13356 insertions(+) create mode 100644 .DS_Store create mode 100644 .gitignore create mode 100644 01-HelloOs/Makefile
error: src refspec main does not match any.
解决方式:(方法不唯一,仅供参考)
统一远程和本地的仓库名称即可
1、把本地的 master 仓库名称修改为远端的 main
重命名命令: git branch -m oldBranchName newBranchName
root@ubuntu:/home/ubuntu/test/mini-riscv-os# git remote add origin git@github.com:/mini-riscv-os-test.git root@ubuntu:/home/ubuntu/test/mini-riscv-os# git push -u origin main error: src refspec main does not match any. error: failed to push some refs to 'git@github.com:/mini-riscv-os-test.git' root@ubuntu:/home/ubuntu/test/mini-riscv-os# git push -u origin main error: src refspec main does not match any. error: failed to push some refs to 'git@github.com:/mini-riscv-os-test.git' root@ubuntu:/home/ubuntu/test/mini-riscv-os# git push -u origin main -f error: src refspec main does not match any. error: failed to push some refs to 'git@github.com:/mini-riscv-os-test.git' root@ubuntu:/home/ubuntu/test/mini-riscv-os# git branch * master root@ubuntu:/home/ubuntu/test/mini-riscv-os# git branch -m master main root@ubuntu:/home/ubuntu/test/mini-riscv-os# git push -u origin main ^C root@ubuntu:/home/ubuntu/test/mini-riscv-os# ssh-agent bash root@ubuntu:/home/ubuntu/test/mini-riscv-os# ssh-agent add ../ssh/github.ssh add: No such file or directory root@ubuntu:/home/ubuntu/test/mini-riscv-os# ssh-add ../ssh/github.ssh Identity added: ../ssh/github.ssh (../ssh/github.ssh) root@ubuntu:/home/ubuntu/test/mini-riscv-os# git push -u origin main