我用 Composer 安装了 Symfony 2(遵循“主”指南),它创建了这个 .git/config 文件:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git://github.com/symfony/symfony-standard
pushurl = git@github.com:symfony/symfony-standard.git
[branch "master"]
remote = origin
merge = refs/heads/master
[remote "composer"]
url = git://github.com/symfony/symfony-standard
fetch = +refs/heads/*:refs/remotes/composer/*
我不想干涉 Composer 在这里所做的事情,因为我不知道它是如何工作的,并且我希望将来能够更新供应商。
那么如何为“myapp”添加我自己的存储库并提交/推送到它?我通常做'git remote add origin ...'并且只使用它,但现在文件中有两个存储库,加上我需要添加的一个。
更新
我用这个命令安装了 Symfony2:
$ php composer.phar create-project symfony/framework-standard-edition myapp
这创建了 myapp/ 并安装了 Symfony2 + 依赖项。但是现在 composer.json 看起来还没有准备好用于我的项目,看起来我的项目本身就是 Symfony2(我认为):
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
"doctrine/orm": "2.2.*",
"doctrine/doctrine-bundle": "dev-master",
"twig/extensions": "dev-master",
"symfony/assetic-bundle": "dev-master",
"symfony/swiftmailer-bundle": "dev-master",
"symfony/monolog-bundle": "dev-master",
"sensio/distribution-bundle": "dev-master",
"sensio/framework-extra-bundle": "dev-master",
"sensio/generator-bundle": "dev-master",
"jms/security-extra-bundle": "1.1.*",
"jms/di-extra-bundle": "1.0.*"
},
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "dev",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web"
}
}
大师指南
- http://symfony.com/doc/master/book/installation.html(第一步,下载symfony,我使用了composer命令,如下图:http: //symfony.com/download)
- http://symfony.com/doc/master/cookbook/workflow/new_project_git.html(这个似乎已经过时了,因为它说我们必须做'git init',但是git repo已经由composer创建)