Git/GitHub can't push to master

前端 未结 11 1809
抹茶落季
抹茶落季 2020-12-07 07:09

I am new to Git/GitHub and ran into an issue. I created a test project and added it to the local repository. Now I am trying to add files/project to the remote repository.

11条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-07 08:09

    I had this issue after upgrading the Git client, and suddenly my repository could not push.

    I found that some old remote had the wrong value of url, even through my currently active remote had the same value for url and was working fine.

    But there was also the pushurl param, so adding it for the old remote worked for me:

    Before:

    [remote "origin"]
        url = git://github.com/user/repo.git
        fetch = +refs/heads/*:refs/remotes/origin/*
        pushurl = git@github.com:user/repo.git
    

    NOTE: This part of file "config" was unused for ages, but the new client complained about the wrong URL:

    [remote "composer"]
        url = git://github.com/user/repo.git
        fetch = +refs/heads/*:refs/remotes/composer/*
    

    So I added the pushurl param to the old remote:

    [remote "composer"]
        url = git://github.com/user/repo.git
        fetch = +refs/heads/*:refs/remotes/composer/*
        pushurl = git@github.com:user/repo.git
    

提交回复
热议问题