【发布时间】:2015-12-08 05:14:39
【问题描述】:
我对使用 git 和 github 非常陌生,但我已经阅读了文档并按照所有说明进行操作,但似乎仍然无法在此处 https://github.com/davejonesbkk/flask-introhttps://github.com/davejonesbkk/flask-intro 上提交我的更改并将其推送到我自己的 Github 存储库中。
当我尝试使用“gut push origin master”进行推送时,登录后返回以下内容:
To https://github.com/davejonesbkk/flask-intro
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/davejonesbkk/flask-intro'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
然后我尝试按照 github 文档中的建议执行“git pull origin master”,它返回以下内容:
From https://github.com/davejonesbkk/flask-intro
* branch master -> FETCH_HEAD
error: The following untracked working tree files would be overwritten by merge:
app.pyc
config.pyc
models.pyc
posts.db
sample.db
saple.db
test.pyc
venv/.Python
venv/bin/activate
venv/bin/activate.csh
venv/bin/activate.fish
然后可能是应用在本地存储的根目录中基本上所有文件等的一百行或更多行,然后是:
Please move or remove them before you can merge.
Aborting
但是我读到我应该能够通过在我已经拥有的根文件夹中拥有一个 .gitignore 文件来解决这个问题,这是它的内容:
*.pyc
venv
.DS_Store
blog
*.db
coverage
tag.py
我在这里阅读了一些关于这个问题的其他问题,他们都建议使用 .gitignore 文件,但我有一个,所以我还需要做什么?
如果有帮助,这也是我的分支和远程分支的输出:
(discover-flask)Davids-MacBook-Air:flask-intro david$ git branch -a
* master
remotes/heroku/master
remotes/origin/master
remotes/upstream/master
(discover-flask)Davids-MacBook-Air:flask-intro david$ git remote -v
heroku https://git.heroku.com/calm-falls-6315.git (fetch)
heroku https://git.heroku.com/calm-falls-6315.git (push)
origin https://github.com/davejonesbkk/flask-intro (fetch)
origin https://github.com/davejonesbkk/flask-intro (push)
upstream https://github.com/davejonesbkk/flask-intro (fetch)
upstream https://github.com/davejonesbkk/flask-intro (push)
我前段时间已经成功推送到这个存储库,但那是一个多月前,在学习教程时,我不确定从那以后发生了什么变化,你可以看到,从那时起我也推送到了 Heroku,但这也是按照教程完成。
顺便说一句,我在 Mac 上,并在使用 virtualenv 时尝试为 Flask 应用推送文件。
任何帮助将不胜感激!
【问题讨论】: