如何将工作树的全部内容推送到远程分支?
How to push the entire content of a working tree to a remote branch?
我正在尝试使用 Aptible platform by following the instructions on https://www.aptible.com/documentation/enclave/tutorials/quickstart-guides/python/django.html 部署 Django 应用程序。我目前有两个遥控器:
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)
我在一个也叫 aptible
:
的分支
Kurts-MacBook-Pro:lucy-web kurtpeek$ git status
On branch aptible
nothing to commit, working tree clean
我想将工作树的全部内容推送到 aptible
远程的 master
分支。在 Recursively add the entire folder to a repository 之后,我尝试了 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
后跟 git push aptible aptible:master
:
Kurts-MacBook-Pro:lucy-web kurtpeek$ git push aptible aptible:master
但是,这给了我来自 Aptible 的以下错误消息:
remote: ERROR -- : No Dockerfile found. Aborting!
然而,目录中有一个Dockerfile
:
Kurts-MacBook-Pro:lucy-web kurtpeek$ ls Dockerfile
Dockerfile
知道为什么 push
没有按预期工作吗? (我也相信该项目使用了 Git 子树,尽管我不确定这是否相关)。
来自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.
基本上,当您 运行 git -am ...
时,这只会提交文件 git 知道您有更改。但是,由于您从未提交 Dockerfile
,不包含在内(因为 git 不知道它)。
您可以从 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
运行 git add --all
在 运行 宁 git commit -am ...
之前实际上没有任何影响:git add --all
确实上演了 Dockerfile
,但是当你运行 git commit -am ...
,Dockerfile
未暂存。
要解决此问题,请不要在 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
我正在尝试使用 Aptible platform by following the instructions on https://www.aptible.com/documentation/enclave/tutorials/quickstart-guides/python/django.html 部署 Django 应用程序。我目前有两个遥控器:
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)
我在一个也叫 aptible
:
Kurts-MacBook-Pro:lucy-web kurtpeek$ git status
On branch aptible
nothing to commit, working tree clean
我想将工作树的全部内容推送到 aptible
远程的 master
分支。在 Recursively add the entire folder to a repository 之后,我尝试了 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
后跟 git push aptible aptible:master
:
Kurts-MacBook-Pro:lucy-web kurtpeek$ git push aptible aptible:master
但是,这给了我来自 Aptible 的以下错误消息:
remote: ERROR -- : No Dockerfile found. Aborting!
然而,目录中有一个Dockerfile
:
Kurts-MacBook-Pro:lucy-web kurtpeek$ ls Dockerfile
Dockerfile
知道为什么 push
没有按预期工作吗? (我也相信该项目使用了 Git 子树,尽管我不确定这是否相关)。
来自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.
基本上,当您 运行 git -am ...
时,这只会提交文件 git 知道您有更改。但是,由于您从未提交 Dockerfile
,不包含在内(因为 git 不知道它)。
您可以从 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
运行 git add --all
在 运行 宁 git commit -am ...
之前实际上没有任何影响:git add --all
确实上演了 Dockerfile
,但是当你运行 git commit -am ...
,Dockerfile
未暂存。
要解决此问题,请不要在 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