错误:无法将某些引用推送到';https://github.com/

错误:无法将某些引用推送到';https://github.com/,git,push,git-push,Git,Push,Git Push,这是我的存储库 当我这样做的时候 $ git push -u origin master remote: Repository not found. fatal: repository 'https://github.com/kiotie32/arbit-text.git/' not found 我使用的是Windows 10计算机。我已将ssh密钥配置为与此笔记本电脑一起使用。 我做了一个ls,我能看见 MINGW64 ~/.ssh $ ls kiotie32_rsa kiotie32_

这是我的存储库 当我这样做的时候

$ git push -u origin master
remote: Repository not found.
fatal: repository 'https://github.com/kiotie32/arbit-text.git/' not found
我使用的是Windows 10计算机。我已将ssh密钥配置为与此笔记本电脑一起使用。 我做了一个ls,我能看见

 MINGW64 ~/.ssh
$ ls
kiotie32_rsa  kiotie32_rsa.pub  known_hosts
我读了上面给出的所有答案 我更改了存储在windows凭据管理器中的密码

我检查
git remote-v | head-n1 | awk'{print$2}'| sed's/*\/'| sed's/\.git/'
我得到以下输出
arbit文本

我更改了存储在windows凭据管理器中的密码可能存储了旧密码

我没有收到任何询问用户名密码的弹出窗口。(已配置ssh密钥,但不确定该密钥是否在此Windows 10环境下工作。我将该密钥存储在git bash中的.ssh中) 现在我知道了

$ git remote add origin https://github.com/kiotie32/arbit-text.git
fatal: remote origin already exists.
那我会的

$ git push -u origin master
error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/kotie32/arbit-text.git'
所以我无法理解为什么会出现这种错误/

我在这里尝试了第一个答案
git提交-m“初始主机”

然后我得到了
$git推送源主机远程:未找到存储库。致命:未找到存储库“github.com/kotie32/arbit text.git”

然后我试着在评论中这样做
git add-all
然后我做了
$git推送源主机远程:未找到存储库。致命:存储库'https://github.com/kotie32/arbit-text.git/'未找到

然后从另一个答案中,我尝试了
$git show ref
79d1730e9aa78f68a11ec4de6a0e8d6b66f17afb参考/头部/主部

然后我做了
$git推送原点磁头:主磁头
远程:未找到存储库。
致命:存储库'https://github.com/kotie32/arbit-text.git/'未找到

我注意到上面url拼写kotie32的最后一个错误应该是错误的
kiotie32
检查.git文件夹中的配置文件 在这里我看到了以下内容

[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
[remote "origin"]
        url = https://github.com/kiotie32/arbit-text.git
        fetch = +refs/heads/*:refs/remotes/origin/*
所以这里的url是正确的,拼写是
kiotie32
,这是正确的

好的,我现在注意到已经形成了两个目录。
project folder/.git/.git
/.git
的配置文件的url错误 而内部的一个,即
/.git/.git
有正确的url

我更改了
/.git
的配置文件,并删除了子目录
.git/.git
新的配置文件已被删除

[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
[remote "origin"]
        url = https://github.com/kiotie32/arbit-text.git
        fetch = +refs/heads/*:refs/remotes/origin/*
然后我又做了

$ git push -u origin master
remote: Repository not found.
fatal: repository 'https://github.com/kiotie32/arbit-text.git/' not found
然后我做到了

$ git remote set-url origin https://github.com/kiotie32/artbit-text.git

现在我可以推到主分支。

只需尝试以下命令:-

git push origin master --force

希望有帮助!谢谢

在以下情况下也可能发生此错误

  • 如果您更改了github用户名、密码或电子邮件
  • 如果在windows配置github凭据时,您试图将提交推送到其他分支
  • 我在上面的场景中遇到了这个错误,我就是这样解决的

  • 已删除存储在Windows凭据管理器中的github凭据

  • 之后,我尝试使用下面的命令再次推送我的提交,然后它提示我输入github凭据。(如果您正在推送其他人的回购,请确保输入该github用户帐户的凭据

    git push-u(回购url)(分行名称)

  • 请尝试使用以下命令:

    git推送
    
    确认用户名和密码 完成。

    还有一件事(以防万一,这可能会对将来的人有所帮助): 你必须提交推送。

    我也遇到了同样的错误。 然后,我意识到原始分支不再称为原始分支。然后,我尝试了这段代码,它成功了:

    git push origin main
    

    用main替换master。

    我也遇到了同样的问题,但这个命令解决了这个问题

    替换:

    git push -u origin master
    
    使用以下命令:

    git push -u origin main
    


    检查您是否尝试在未提交的情况下推送。尝试提交更改

    git commit -m "my commit"
    
    或者键入
    git branch
    查看是否设置了远程url。如果没有显示任何内容,则添加远程源url
    git remote add originhttps://github.com/username/projectname.git

    然后尝试git push origin master

    通常我在尝试“git push”命令时会收到此错误消息。 运行以下命令

    git add --all
    
    然后


    它应该可以解决您的问题。希望它对其他人有帮助!

    如果您遇到此错误,可能

    • 您不在计算机上有回购协议的主目录中

    -您尚未添加或提交更改


    只是一个提示。

    实际上,这是由于更改Github帐户的凭据而发生的。

    例如,您的gitbash在过去是同步到'A'帐户Repositery的,从您拉或推,但此时您要推或拉'B'帐户Repositery
    。这意味着您试图推或拉Repositery,它是blong到其他帐户而不是旧帐户。 此时出现此异常(错误“无法将某些引用推送到”https://github.com/"""将会上升

    实际上,操作系统(linux或windows)将您的帐户身份验证存储在旧帐户的凭据管理器中。当您从帐户“B”Repo(新帐户)推送或拉取时

    Gitbash使用存储在OS Credential Manager中的帐户“A”(旧帐户)的凭据验证您的帐户“B”(新帐户)。然后引发此错误

    解决方案

  • 在Windows搜索栏中键入“凭据管理器”
  • 2.打开凭证管理器 3.单击Windows凭据

  • “点击git:https://GitHub.com“
  • 删除凭证后。您将推送凭证,并在凭证进行身份验证时询问新帐户的详细信息。您的代码将被推送或拉送

  • 如果你不能拉或推比你设置

  • 您的电子邮件和您的姓名,而不是推送

    git config  user.email 'xxxx@gmail.com'
    git config user.name 'xxxxx'
    
    再推

    git push -u origin branch_name
    
    谢谢你的提问


    我面临同样的问题,我执行以下命令

    git add --all
    
    git add--all

    此命令用于添加所有文件,然后完成提交

    git提交-m[消息]

    然后
    git push -u origin branch_name
    
    git push origin master:main
    
    git push --set-upstream origin main