Git/GitHub can't push to master

前端 未结 11 1831
抹茶落季
抹茶落季 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:14

    Mark Longair's solution using git remote set-url... is quite clear. You can also get the same behavior by directly editing this section of the .git/config file:

    before:

    [remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = git://github.com/my_user_name/my_repo.git
    

    after:

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

    (And conversely, the git remote set-url... invocation produces the above change.)

提交回复
热议问题