Bower zainstalować za pomocą tylko https?

Próbuję skonfigurować Bower na serwerze zbudowanym w Centrum Danych naszej organizacji, ale port git nie wydaje się być otwarty na zaporze w centrum danych. Mogę użyć klienta wiersza poleceń git do klonowania poprzez https://[repo], ale nie git://[repo].

Czy istnieje switch lub preferencja, która poleci bowerowi wykonanie git clone używając https zamiast git protokołu?

Spojrzałem na źródło i rozważałem zmianę kodu rozdzielczości na git:// na https://, ale pomyślałem Zapytałbym, zanim przejdę do tego.

Author: Jonathan Jalouzot, 2013-03-28

3 answers

Możesz sprawić, że git zastąpi protokół za Ciebie. Just run:

git config --global url."https://".insteadOf git://

Aby użyć protokołu HTTPS zamiast Git.

 626
Author: Sindre Sorhus,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-01-23 15:44:46

Bazując na odpowiedzi od @ Sindre, napisałem małą funkcję pomocniczą w bashu, która mieszka w moim pliku ~/.bashrc. Nazwij to tak, jak byś to zrobił grunt, z tym, że teraz nazywa się nngrunt. Smacznego!

function nngrunt
{
    # Add a section to the global gitconfig file ~/.gitconfig that tells git to
    # go over http instead of the git protocol, otherwise bower has fits...
    # See http://stackoverflow.com/questions/15669091/bower-install-using-only-https
    git config --global url."https://".insteadOf git://

    # Run grunt w/ any supplied args
    grunt "$@"

    # Now cleanup the section we added to the git config file
    # Of course we have our own extra cleanup to do via sed since the unset command
    # leaves the section around
    # See http://git.661346.n2.nabble.com/git-config-unset-does-not-remove-section-td7569639.html
    git config --global --unset url."https://".insteadOf
    sed -i 's/\[url "https:\/\/"\]//' ~/.gitconfig
    sed -i '/^$/d' ~/.gitconfig
}
 2
Author: quickshiftin,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-12-19 18:28:05

git config --global url."git://".insteadOf https://

 0
Author: Mansoorulhaq Mansoor,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-08-05 04:39:37