zoukankan      html  css  js  c++  java
  • 第一次将本地项目push到github

    问题:github有一个空项目,将本地项目上传到github空项目时,报错如下

    $ git push --set-upstream git@github.com:dslu7733/promise.git master
    error: src refspec master does not match any.
    error: failed to push some refs to 'git@github.com:dslu7733/promise.git'
    

    解决办法

    1. 账户问题

    我的本地以前配置过2个github账户的SSH,可以在用户(eg. user/username)文件夹下查看.ssh文件夹。这是windows系统生成ssh密匙的默认路径,里面有3个比较重要的文件:config dslu7733_rsa dslu7733_rsa.pub
    (这里的dslu7733是我github的账号名,其中dslu7733_rsa和dslu7733_rsa.pub是与ssh密匙相关,主要看config的内容)

    config决定了本地主机如何解析域名

    Host github-dslu
    HostName github.com
    User git
    IdentityFile ~/.ssh/dslu7733_rsa
    

    可以看到,本地域名github-dslu(Host)解析为github.com, 同时本地用户为git, IdentityFile指明ssh密匙所在路径。

    2. pull

    当然本地需要先git add.git commit

    $ git pull -f git@github-dslu:dslu7733/promise.git master --allow-unrelated-histories
    

    这里我就把git@github.com:dslu7733/promise.git改为了git@github-dslu:dslu7733/promise.git, 当然本地只配置了一个SSH账户的不需要改

    由于第一次pull,2个项目不相干(unrelated-histories),所有需要命令--allow-unrelated-histories

    3. push

    git push --set-upstream git@github-dslu:dslu7733/promise.git master
    

    最后因为第一次push, 需要命令--set-upstream

  • 相关阅读:
    T100添加合计
    T100整单操作维护交运方式
    错误代码:11300001 数据集配置错误Query:ORA-01652: 无法通过 128 (在表空间 TEMP 中) 扩展 temp 段
    T100 技术汇总
    帆软取年月常用函数
    使用oracle DB_LINK的一个注意点
    单行拆转多行的查询
    SQL-Oracle内实现柱形图式的效果
    SQL-删除重复记录
    MERGE语法详解
  • 原文地址:https://www.cnblogs.com/friedCoder/p/12237690.html
Copyright © 2011-2022 走看看