如何让作曲家不为包创建 .git 目录 [英] How to make composer NOT create a .git directory for a package

查看:26
本文介绍了如何让作曲家不为包创建 .git 目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I found a couple related posts, but those don't really answer my question. Let's say I want to install this package: https://github.com/pear/Net_Socket

an excerpt from my composer.json:

{
    "config": {
        "preferred-install": "dist"
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/pear/Net_Socket.git"
        }
    ],
    "require": {
        "pear/net_socket": "*",
    }
}

So I need it to be installed without the .git directory so it is not seen as a submodule in my project. How do I make it download a "dist" version, like others said? Do I have to tag a commit?

解决方案

If a package is seen as a git submodule, you haven't excluded the vendor folder from being committed to your own repository. It is recommended to add the vendor folder to .gitignore, and not commit these files, only commit composer.lock (and composer.json of course).

Apart from that, running composer install --prefer-dist should do the job. Note that Composer seems to not change the download method used first if you change your mind later. If Composer detects a cloned repo, it is faster to just update that instead of downloading a ZIP and unpacking it. If you want to change that, delete the whole vendor folder and run composer update --prefer-dist.

这篇关于如何让作曲家不为包创建 .git 目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆