[英]How to push the entire content of a working tree to a remote branch?
I'm trying to deploy a Django app using the Aptible platform by following the instructions on https://www.aptible.com/documentation/enclave/tutorials/quickstart-guides/python/django.html . 我正在按照https://www.aptible.com/documentation/enclave/tutorials/quickstart-guides/python/django.html上的说明,尝试使用Aptible平台部署Django应用。 I currently have two remotes:
我目前有两个遥控器:
Kurts-MacBook-Pro:lucy-web kurtpeek$ git remote -v
aptible git@beta.aptible.com:lucy/web.git (fetch)
aptible git@beta.aptible.com:lucy/web.git (push)
origin https://github.com/startwithlucy/lucy.git (fetch)
origin https://github.com/startwithlucy/lucy.git (push)
I'm on a branch which is also called aptible
: 我在也称为
aptible
的分支上:
Kurts-MacBook-Pro:lucy-web kurtpeek$ git status
On branch aptible
nothing to commit, working tree clean
I would like to push the entire contents of the working tree to the master
branch of the aptible
remote. 我想将工作树的全部内容推
aptible
遥控器的master
分支。 Following Recursively add the entire folder to a repository , I tried a git add --all
followed by a git commit -a
, 递归地将整个文件夹添加到存储库之后 ,我尝试了
git add --all
然后是git commit -a
,
Kurts-MacBook-Pro:lucy-web kurtpeek$ git commit --help
Kurts-MacBook-Pro:lucy-web kurtpeek$ git add --all
Kurts-MacBook-Pro:lucy-web kurtpeek$ git commit -am "Git add --all followed by git commit -am"
[aptible 9ea97969] Git add --all followed by git commit -am
2 files changed, 9254 insertions(+)
create mode 100644 docker-compose.yml
create mode 100644 lucy-app/package-lock.json
followed by a git push aptible aptible:master
: 其次是
git push aptible aptible:master
:
Kurts-MacBook-Pro:lucy-web kurtpeek$ git push aptible aptible:master
However, this is giving me the following error message from Aptible: 但是,这给了我来自Aptible的以下错误消息:
remote: ERROR -- : No Dockerfile found. Aborting!
There is, however, a Dockerfile
in the directory: 但是,目录中有一个
Dockerfile
:
Kurts-MacBook-Pro:lucy-web kurtpeek$ ls Dockerfile
Dockerfile
Any idea why this push
is not working as expected? 知道为什么此
push
未按预期进行吗? (I also believe that the project makes use of Git subtrees, though I'm not sure whether this is relevant). (我也相信该项目利用了Git子树,尽管我不确定这是否相关)。
From man git-commit
: 从
man git-commit
:
-a, --all
Tell the command to automatically stage files that have been
modified and deleted, but new files you have not told Git about are
not affected.
Basically, when you run git -am ...
, this only commits files git knows about that you have changes in. However, since you never committed your Dockerfile
, that does not get included (because git does not know abut it). 基本上,当你运行
git -am ...
,这只是提交文件的Git知道你已经在改变。但是,因为你永远不承诺你Dockerfile
,不得到包括(因为Git 并不知道它紧靠)。
You can confirm this from the output of git commit -am
: only docker-compose.yml
and lucy-app/package-lock.json
were committed: 您可以从
git commit -am
的输出中确认这git commit -am
:仅git commit -am
docker-compose.yml
和lucy-app/package-lock.json
:
[aptible 9ea97969] Git add --all followed by git commit -am
2 files changed, 9254 insertions(+)
create mode 100644 docker-compose.yml
create mode 100644 lucy-app/package-lock.json
Running git add --all
before running git commit -am ...
actually has no impact whatsoever: git add --all
does stage the Dockerfile
, but when you run git commit -am ...
, the Dockerfile
is unstaged. 实际上,在运行
git commit -am ...
之前运行git add --all
实际上没有任何影响: git add --all
确实会Dockerfile
,但是当您运行git commit -am ...
,该Dockerfile
是未暂存的。
To fix this, don't use the -a
flag on git commit
, like this: 要解决此问题,请不要在
git commit
上使用-a
标志,如下所示:
$ git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
Dockerfile
nothing added to commit but untracked files present (use "git add" to track)
$ git add --all
$ git commit -m 'Add Dockerfile'
[master 6296160] Add Dockerfile
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 Dockerfile
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.