我正在學習git,並且在推送我在Github中創建的新存儲庫中的現有文件時遇到問題。如何推送新的Github存儲庫中的現有項目?
這裏就是我所做的:
- 我執行此我的項目
- git init
- 我添加的文件在本地倉庫
- git add .
- 我犯
- git commit -m "This is the base code for the project"
- 然後我複製GitHub的倉庫URL裏面在我的Github頁
https://github.com/myname/my_projects.git
- 然後我指出版本庫
- git remote add origin https://github.com/myname/my_projects.git
- 然後,我把我的文件
- git push origin master
然後做推後,我有這樣的錯誤:
λ git push origin master
Username for 'https://github.com': myname
Password for 'https://[email protected]':
To https://github.com/myname/my_projects.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/myname/my_projects.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 integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
你能幫助我嗎?
....你試圖把多個不同的項目到同一個GitHub庫? – NightShadeQueen
不,只有一個項目 – Jerielle