LZN's Blog CodePlayer

【solved, git&github】URL problem


When I pushed all ncl file in project to github, I got this error:

[yangsong3@localhost project]$ git push -u origin master
To https://Novarizark@github.com/Novarizark/project.git
 ! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://Novarizark@github.com/Novarizark/pro ject.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.

Google it, found the solution on Stackoverflow

You need to add the origin remote:

    Delete the current one

    git remote rm origin

    Add the git remote link ex: (https://user@bitbucket.org/test.git or https://github.com/user/test.git)

    git remote add origin link

    git pull origin master (or other branch)

It is the Username@github made the bad result. So there should be other ways to solve the 403 or ssh error.

Similar Posts