我知道已经提出了类似的问题.
但是,我认为我的问题是由于我之前犯的错误,因此是不同的:让我解释一下.
一切顺利,我可以:
git add . 我本地存储库中的所有文件.git commit -m "message here" 添加消息到我的提交.git push origin master 将我的文件上传到GitHub.git push heroku master 将我的文件上传到Heroku.但是,在某些时候,我在本地创建了一个新的分支add-calendar-model,以防应用程序开发的后续步骤向南...
......这正是发生的事情.
然而,尽管进行了许多尝试,但我没有设法从master分支到我的本地存储库获取初始代码 - 即我创建新分支之前的代码.
所以,我决定从GitHub 手动删除本地存储库和git clone我的master分支中的所有文件.
这样,我恢复了所有文件,但现在,我无法再将其推送到远程存储库.
任何时候我尝试运行git push origin add-calendar-model或git push origin master,我收到以下错误:
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository …Run Code Online (Sandbox Code Playgroud) 我正在尝试将代码从我的应用程序更新到我的存储库,并出现错误.
我该如何解决?
C:\Sites\ecozap>git push heroku master
Enter passphrase for key '/c/Users/Diseño2/.ssh/id_rsa':
Fetching repository, done.
To git@heroku.com:ecozap.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@heroku.com:ecozap.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud) 我刚刚完成了一段代码.想要推动并获得已经很有名的:
提示:更新被拒绝,因为当前分支的提示背后提示:它的远程对应物.在再次推送之前集成远程更改(例如提示:'git pull ...').
现在我已经在这里多次看过这个问题,例如
更新被拒绝,因为您当前分支的提示背后提示:它的远程对应物.整合远程变更(例如
根据具体情况,解决方案要么是
git pull,所以远程更改合并到我的本地工作,或git push -f,强制推动更新远程(原点)分支.现在,我已经有一段时间没有在这个分支上工作了.我不一定想将远程更改合并到我当前的工作中!我也不知道我是否可以安全地强制更新原始分支...
我怎样才能看出差异并决定哪种情况最适合我的情况?