我正在尝试使用roots作为我的首发主题来设置我的第一个基于Git的WordPress主题开发 . 我计划在本地开发一个主题,然后不时推送到我的Dreamhost VPS . 阅读Dreamhost Wiki上的一些信息 . 关于使用Git设置WordPress核心更新选项,我也跟着David Winter's tutorial . 我还为我的主题设立了另一个回购,主题是作为基础 . 也许我应该把它作为一个子模块,但我只是在这里学习..我在服务器上设置了一个裸仓库,在本地我尝试发出拉取请求,但这不起作用 .
Locally
对于我的本地主题,我有这个:
$ pwd
/opt/local/www/imagewize/wp-content/themes/img/.git
jaspersmbp:.git jasper$ cat config
这里是主题的git配置文件:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[remote "origin"]
url = ssh://me@domain.com/~/domain.com/wp-content/themes/img
fetch = +refs/heads/*:refs/remotes/origin/*
WordPress子模块的详细信息是:位置:
$ pwd
/opt/local/www/imagewize
Git配置文件:
core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[submodule "wordpress"]
url = git://github.com/WordPress/WordPress.git
Remote
在主题内的远程DH VPS我有这个配置:
core]
repositoryformatversion = 0
filemode = true
bare = true
当我在本地主题内部并尝试连接到Dreamhost VPS时,我得到:
$ git pull origin master
fatal: Couldn't find remote ref master
me:img jasper$ fatal: The remote end hung up unexpectedly
Debugging
$ git branch -a
在当地加载nada ..
git push origin master
error: src refspec master does not match any.
error: failed to push some refs to 'ssh://me@domain.com/~/imagewize.com/wp-content/themes/img'
Update
在配置中调整了url,现在我得到:
git push origin master
fatal: '/imagewize.com/wp-content/themes/img' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
Update II
我做了一些更多的在线阅读,在我找到src refspec master does not match any when pushing commits in git后,我意识到我确实添加了,但没有提交 .
git commit -m 'Initial commit'
[master (root-commit) 7bbcd6a] Initial commit
137 files changed, 17766 insertions(+)
create mode 100644 .gitignore
.........
然后:
$ git push origin master
Counting objects: 150, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (144/144), done.
Writing objects: 100% (150/150), 259.70 KiB, done.
Total 150 (delta 26), reused 0 (delta 0)
To ssh://me@domain.com/~/domain.com/wp-content/themes/img/
* [new branch] master -> master
我们正在运转!
只是某种程度上我的本地文件没有上传到远程主题文件夹
$ ls -lha
total 16K
drwxrwxr-x 7 me server 147 Oct 7 20:21 .
drwxr-xr-x 6 me server 105 Oct 7 20:21 ..
-rw-rw-r-- 1 me server 23 Oct 7 20:21 HEAD
drwxrwxr-x 2 me server 10 Oct 7 20:21 branches
-rw-rw-r-- 1 me server 66 Oct 7 20:21 config
-rw-rw-r-- 1 me server 73 Oct 7 20:21 description
drwxrwxr-x 2 me server 4.0K Oct 7 20:21 hooks
drwxrwxr-x 2 me server 28 Oct 7 20:21 info
drwxrwxr-x 4 me server 40 Oct 7 20:21 objects
drwxrwxr-x 4 me server 41 Oct 7 20:21 refs
,但我应该尽快解决这个问题..
Update III
Bare存储库没有工作目录,似乎解释了here . 他们似乎说我应该克隆 生产环境 . 因此,无论我在哪里创建裸存储库,都不是克隆最终结果的地方 .
1 回答
只需更改设置即可 . 我推动的地方就是git repo,用于跟踪像Github这样的变化,无论我想在哪里得到最终结果,我都会克隆回购 .