• error: src refspec main does not match any.


    生成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
  • 相关阅读:
    阿里云安装Mono 发生错误解决方法
    在Entity Framework 中执行Tsql语句
    WinRT app guide
    开源稳定的消息队列 RabbitMQ
    Catpic: OpenSocial Container on .NET
    MSDTC 故障排除
    HTML5 canvas图形库RGraph
    《我的WCF之旅》博文系列汇总
    TSQL Enhancement in SQL Server 2005[下篇]
    谈谈基于SQL Server 的Exception Handling[上篇]
  • 原文地址:https://www.cnblogs.com/dream397/p/15714735.html
Copyright © 2020-2023  润新知