Git/GitHub can't push to master

前端 未结 11 1832
抹茶落季
抹茶落季 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 07:59

    I added my pubkey to github.com and this was successful:

    ssh -T git@github.com
    

    But I received the "You can't push" error after having wrongly done this:

    git clone git://github.com/mygithubacct/dotfiles.git
    git remote add origin git@github.com:mygithubacct/dotfiles.git
    ...edit/add/commit
    git push origin master
    

    Instead of doing what I should have done:

    mkdir dotfiles
    cd dotfiles
    git init
    git remote add origin git@github.com:mygithubacct/dotfiles.git
    git pull origin master
    ...edit/add/commit
    git push origin master
    

提交回复
热议问题