Push existing project into Github

后端 未结 18 882
天涯浪人
天涯浪人 2020-12-04 04:25

I have a folder with my project sources. How I can push this project into Github\'s repository?

I tried using this steps:

  1. I created empty repository o
18条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-04 05:13

    git init
    git add .
    git commit -m "Initial commit"
    git remote add origin 
    git push -f origin master
    

    The -f option on git push forces the push. If you don't use it, you'll see an error like this:

    To git@github.com:roseperrone/project.git
     ! [rejected]        master -> master (fetch first)
    error: failed to push some refs to 'git@github.com:roseperrone/project.git'
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first merge the remote changes (e.g.,
    hint: 'git pull') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    

提交回复
热议问题