【发布时间】:2019-08-22 01:02:34
【问题描述】:
我在使用 Git 时遇到了一些问题。
我已经在 Digital Ocean 液滴上托管了一个实时站点。我想将我的代码推送到 github 存储库,然后在本地进行所有开发。我会将本地代码推送到 github,然后通过从 github 拉取来更新实时站点。
但是,我在起步时遇到了一些麻烦。
我已经创建了 repo,我在项目上做了一个快速的git init。我已经添加了文件,进行了提交,然后添加了 repo。但是,当我运行 git push 时,我得到了这个:
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream github master
所以,我跑了git push --set-upstream github master。它给了我这个错误:
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/WordsofDefiance/davidaccomazzo.com.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.
谁能帮我创建这个对 repo 的初始提交?我想我错过了一些超级基本的东西。
编辑:我最终在推送时使用了--force,它起作用了。谢谢。
【问题讨论】:
标签: git github web-deployment