代码之家  ›  专栏  ›  技术社区  ›  Tom

无法将项目添加到github存储库

  •  -1
  • Tom  · 技术社区  · 6 年前

    我首先通过选择new repository在github中创建了一个存储库。然后它给了我以下上传选项

    or create a new repository on the command line
    echo "# xx" >> README.md
    git init
    git add README.md
    git commit -m "first commit"
    git remote add origin https://github.com/xxxxxx/xx.git
    git push -u origin master
    
    …or push an existing repository from the command line
    git remote add origin https://github.com/xxxxxx/xx.git
    git push -u origin master
    

    当我尝试任何一个选项时,它似乎都不会将文件上载到 https://github.com/xxxxxx/xx.git

    相反,它看起来好像无法远程存储库,并试图提交到我从中提取它的现有存储库。不确定如何将其指向远程存储库。如果我在项目文件夹上执行git分支,我可以看到现有git存储库的分支

    我错过了什么

    1 回复  |  直到 6 年前
        1
  •  0
  •   Laurens Deprost    6 年前

    你可能需要换个房间 origin

    • 将远程URL更改为新的GitHub repo:
      git remote set-url origin https://github.com/USERNAME/REPOSITORY.git

    • 验证远程URL是否正确:
      git remote -v

    • 推出新回购协议:
      git push origin master

    编辑:
    代理
    之后 从.gitrc中删除代理 (备份后)推送操作无错误:
    git config --global --unset https.proxy
    git config --global --unset http.proxy
    (或手动编辑) .gitrc )