我有一个Bitnami WordPress vm,我正在试验https配置。它的Apache配置目录如下所示,我可以对其进行ssh处理。
不过,我更愿意在本地编辑文件(macos使用崇高文本)。
我经常开始用Git跟踪一个现有的配置目录,它运行得很好。问题是我不知道如何在遥控器上获得相同的工作流。
bitnami@debian:/opt/bitnami/apache2$ tree conf -d
conf
├── bitnami
├── extra
└── original
└── extra由于某些原因,我未能让git daemon令人满意地工作,所以我最终使用了git,而不是ssh。这很好,因为我避免了在VM上保护git。
不过,我不太可能按我的意愿去工作。(在这两种情况下,我都事先将实际的conf复制到~/temp中)。
试试看#1吉特-裸:
VM-侧:
git init工作,我看到我所有的文件+ git的东西:
bitnami@debian:~/temp$ cp -r /opt/bitnami/apache2/conf/ .
bitnami@debian:~/temp$ cd conf
bitnami@debian:~/temp/conf$ git init --bare
Initialized empty Git repository in /home/bitnami/temp/conf/
bitnami@debian:~/temp/conf$ ls -ltr | tail -10
-rw-r--r-- 1 bitnami bitnami 891 Sep 22 04:07 ca.key
drwxr-xr-x 2 bitnami bitnami 4096 Sep 22 04:07 bitnami
drwxr-xr-x 4 bitnami bitnami 4096 Sep 22 04:10 refs
drwxr-xr-x 4 bitnami bitnami 4096 Sep 22 04:10 objects
drwxr-xr-x 2 bitnami bitnami 4096 Sep 22 04:10 info
drwxr-xr-x 2 bitnami bitnami 4096 Sep 22 04:10 hooks
-rw-r--r-- 1 bitnami bitnami 23 Sep 22 04:10 HEAD
-rw-r--r-- 1 bitnami bitnami 73 Sep 22 04:10 description
-rwxr--r-- 1 bitnami bitnami 66 Sep 22 04:10 config
drwxr-xr-x 2 bitnami bitnami 4096 Sep 22 04:10 branchesMac端的git克隆不复制任何文件:
jluc@temp$ git clone ssh://bitnami@$IP_WP2/home/bitnami/temp/conf
Cloning into 'conf'...
bitnami@192.168.1.147's password:
warning: You appear to have cloned an empty repository.
jluc@temp$ cd conf
jluc@conf$ ls -ltr
jluc@conf$没错,mac上没有文件。
空中楼阁。让我们将它们添加到服务器上。
只是它不管用。
bitnami@debian:~/temp/conf$ git add .
fatal: This operation must be run in a work tree试试看#2 git init,不要--裸的
VM-侧:
bitnami@debian:~/temp/conf$ cd ..
bitnami@debian:~/temp$ rm -rf conf/
bitnami@debian:~/temp$ cp -r /opt/bitnami/apache2/conf/ .
bitnami@debian:~/temp$ cd conf
bitnami@debian:~/temp/conf$ git init .
Initialized empty Git repository in /home/bitnami/temp/conf/.git/然后添加所有内容:
bitnami@debian:~/temp/conf$ git add .
bitnami@debian:~/temp/conf$ git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: bitnami/bitnami-apps-prefix.conf
new file: bitnami/bitnami-apps-vhosts.conf
new file: bitnami/bitnami.conf
new file: bitnami/httpd-2xlarge.conf
....并做出承诺
git commit -am "just init"
[master (root-commit) a13fb20] just init
50 files changed, 7847 insertions(+)
create mode 100644 bitnami/bitnami-apps-prefix.conf
create mode 100644 bitnami/bitnami-apps-vhos
...麦克赛德:
克隆人。
jluc@temp$ git clone ssh://bitnami@$IP_WP2/home/bitnami/temp/conf
Cloning into 'conf'...
bitnami@192.168.1.147's password:
Permission denied, please try again.
bitnami@192.168.1.147's password:
remote: Counting objects: 45, done.
remote: Compressing objects: 100% (45/45), done.
remote: Total 45 (delta 8), reused 0 (delta 0)
Receiving objects: 100% (45/45), 84.87 KiB | 0 bytes/s, done.
Resolving deltas: 100% (8/8), done.创建一个虚拟文件并提交:
jluc@temp$ cd conf
jluc@conf$ touch test.txt
jluc@conf$ git add test.txt
jluc@conf$ git commit -am "just a test.txt file to test"
[master 3789f21] just a test.txt file to test
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 test.txt当我推它的时候它会出错:
jluc@conf$ git push origin master
bitnami@192.168.1.147's password:
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 282 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
..... more stuff...
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To ssh://192.168.1.147/home/bitnami/temp/conf
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'ssh://bitnami@192.168.1.147/home/bitnami/temp/conf'我查看了许多git init --裸露的帖子,但还没有真正找到与我的用例匹配的一个。
git版本之间存在一些相关的更改,有时会出现冲突,这无助于此。
git config --bool core.bare true,按照https://stackoverflow.com/questions/11117823/git-push-error-refusing-to-update-checked-out-branch会有帮助吗?那我什么时候运行呢?在mac克隆人之后?我试过这样做,我的git推送源文件没有抱怨,但我也没有在VM上看到我的新test.txt文件。
而且git-how-to-start-tracking-an-existing-project似乎是相关的,但是可接受的答案的链接返回一个404错误。
发布于 2017-09-26 04:47:27
对于您的情况,通常的工作流是:
这样,每次推送时,文件都会在原来的Apache文件夹中签出。
(根据情况调整路径)
https://stackoverflow.com/questions/46415232
复制相似问题