Jam*_*sen 480 git proxy git-submodules
注意:虽然描述的用例是关于在项目中使用子模块,但同样适用于git cloneHTTP上的存储库的常规.
我在Git控制下有一个项目.我想添加一个子模块:
git submodule add http://github.com/jscruggs/metric_fu.git vendor/plugins/metric_fu
Run Code Online (Sandbox Code Playgroud)
但我明白了
...
got 1b0313f016d98e556396c91d08127c59722762d0
got 4c42d44a9221209293e5f3eb7e662a1571b09421
got b0d6414e3ca5c2fb4b95b7712c7edbf7d2becac7
error: Unable to find abc07fcf79aebed56497e3894c6c3c06046f913a under http://github.com/jscruggs/metri...
Cannot obtain needed commit abc07fcf79aebed56497e3894c6c3c06046f913a
while processing commit ee576543b3a0820cc966cc10cc41e6ffb3415658.
fatal: Fetch failed.
Clone of 'http://github.com/jscruggs/metric_fu.git' into submodule path 'vendor/plugins/metric_fu'
Run Code Online (Sandbox Code Playgroud)
我设置了HTTP_PROXY:
c:\project> echo %HTTP_PROXY%
http://proxy.mycompany:80
Run Code Online (Sandbox Code Playgroud)
我甚至为http代理设置了全局Git:
c:\project> git config --get http.proxy
http://proxy.mycompany:80
Run Code Online (Sandbox Code Playgroud)
有没有人获得HTTP提取以始终通过代理工作?真正奇怪的是GitHub上的一些项目工作正常(awesome_nested_set例如),但其他项目一直都失败(例如rails).
Der*_*har 571
您还可以设置Git在全局配置属性中使用的HTTP代理http.proxy:
git config --global http.proxy http://proxy.mycompany:80
Run Code Online (Sandbox Code Playgroud)
要使用代理进行身份验证:
git config --global http.proxy http://mydomain\\myusername:mypassword@myproxyserver:8080/
Run Code Online (Sandbox Code Playgroud)
(信用证转到@EugeneKulabuhov和@JaimeReynoso获取身份验证格式.)
Max*_*eod 145
这已经有了一些很好的答案.但是,我认为我会填写,因为一些代理服务器要求您使用用户ID和密码进行身份验证.有时这可能在域上.
因此,例如,如果您的代理服务器配置如下:
Server: myproxyserver
Port: 8080
Username: mydomain\myusername
Password: mypassword
Run Code Online (Sandbox Code Playgroud)
然后,.gitconfig使用以下命令添加到您的文件:
git config --global http.proxy http://mydomain\\myusername:mypassword@myproxyserver:8080
Run Code Online (Sandbox Code Playgroud)
别担心https.只要指定的代理服务器支持http和https,配置文件中的一个条目就足够了.
然后,您可以.gitconfig通过执行cat .gitconfig以下操作验证该命令是否已成功将条目添加到文件中:
在文件的末尾,您将看到如下条目:
[http]
proxy = http://mydomain\\myusername:mypassword@myproxyserver:8080
Run Code Online (Sandbox Code Playgroud)
而已!
Jam*_*sen 121
最终工作的是设置http_proxy环境变量.我设置HTTP_PROXY正确,但git显然更喜欢小写版本.
小智 48
看起来你正在Windows上使用Gitw编译Git(或者可能是另一个我没有听说过的).有一些方法可以调试这个:我相信git的所有http代理工作都是由curl完成的.在运行git之前设置此环境变量:
GIT_CURL_VERBOSE=1
Run Code Online (Sandbox Code Playgroud)
这至少应该让您了解幕后发生的事情.
ali*_*dro 32
如果您只想在指定的存储库上使用代理,则不需要在其他存储库上.-c, --config <key=value>当您git clone使用存储库时,首选方法是选项.例如
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git --config "http.proxy=proxyHost:proxyPort"
Run Code Online (Sandbox Code Playgroud)
bba*_*iee 26
当您的网络团队通过重写证书进行ssl检查时,然后使用http url而不是https,并结合设置此var为我工作.
git config --global http.proxy http://proxy:8081
Run Code Online (Sandbox Code Playgroud)
STB*_*and 19
您也可以编辑位于Windows系统上的%userprofile%目录(notepad%userprofile%.gitconfig)或Linux系统上的〜目录(vi~/.gitconfig)中的.gitconfig文件,并添加如下所示的http部分.
.gitconfig文件的内容:
[http]
proxy = http://proxy.mycompany:80
Run Code Online (Sandbox Code Playgroud)
Ton*_*190 17
对我来说,git://虽然https://确实无法通过代理工作.这引起了一些麻烦,因为我运行的脚本都使用了git://所以我不能轻易地改变它们.但是我找到了这个创业板
git config --global url."https://github.com/".insteadOf git://github.com/
Run Code Online (Sandbox Code Playgroud)
Ben*_*ton 16
这是一个老问题,但如果您使用的是Windows,请考虑在通过https URL检索时设置HTTPS_PROXY.为我工作!
Car*_*sin 11
我找不到http.proxy也不GIT_PROXY_COMMAND适用于我的身份验证的http代理.代理不会以任何方式触发.但我找到了解决这个问题的方法.
创建一个authfile.格式为authfile:user_name:password,和user_name,password是您访问代理的用户名和密码.要创建这样的文件,只需运行如下命令:echo "username:password" > ~/.ssh/authfile.
编辑~/.ssh/config,并确保其权限是644:chmod 644 ~/.ssh/config
以github.com为例,将以下行添加到~/.ssh/config:
Host github.com
HostName github.com
ProxyCommand /usr/local/bin/corkscrew <your.proxy> <proxy port> %h %p <path/to/authfile>
User git
Run Code Online (Sandbox Code Playgroud)
现在,只要你做任何事情git@github.com,它就会自动使用代理.您也可以轻松地对Bitbucket做同样的事情.
这并不像其他方法那么优雅,但它就像一个魅力.
Bor*_*ski 10
在Windows上,如果您不想在纯文本中将密码放在.gitconfig中,则可以使用
它针对普通甚至Windows NTLM代理对您进行身份验证,并在不进行身份验证的情况下启动localhost-proxy.
为了让它运行:
将git指向新的localhost代理:
[http]
proxy = http://localhost:3128 # change port as necessary
Run Code Online (Sandbox Code Playgroud)小智 8
将 Git credential.helper 设置为 wincred。
git config --global credential.helper wincred
Run Code Online (Sandbox Code Playgroud)
确保只有 1 个 credential.helper
git config -l
Run Code Online (Sandbox Code Playgroud)
如果超过 1 且未设置为 wincred,则将其删除。
git config --system --unset credential.helper
Run Code Online (Sandbox Code Playgroud)
现在设置没有密码的代理。
git config --global http.proxy http://<YOUR WIN LOGIN NAME>@proxy:80
Run Code Online (Sandbox Code Playgroud)
检查您添加的所有设置是否正常....
git config --global -l
Run Code Online (Sandbox Code Playgroud)
现在你可以走了!
对我来说它的作用是:
sudo apt-get install socat
Run Code Online (Sandbox Code Playgroud)
使用以下命令在$ BIN_PATH/gitproxy中创建一个文件:
#!/bin/sh
_proxy=192.168.192.1
_proxyport=3128
exec socat STDIO PROXY:$_proxy:$1:$2,proxyport=$_proxyport
Run Code Online (Sandbox Code Playgroud)
别忘了给它执行权限
chmod a+x gitproxy
Run Code Online (Sandbox Code Playgroud)
运行以下命令来设置环境:
export PATH=$BIN_PATH:$PATH
git config --global core.gitproxy gitproxy
Run Code Online (Sandbox Code Playgroud)
我遇到了同样的问题,但修复方法略有不同:REBUILDING GIT WITH HTTP SUPPORT
该git:协议无法通过我的公司防火墙。
例如,这超时:
git clone git://github.com/miksago/node-websocket-server.git
Run Code Online (Sandbox Code Playgroud)
curl github.com不过,工作得很好,所以我知道我的http_proxy环境变量是正确的。
我尝试使用http,如下所示,但立即出现错误。
git clone http://github.com/miksago/node-websocket-server.git
->>> fatal: Unable to find remote helper for 'http' <<<-
Run Code Online (Sandbox Code Playgroud)
我尝试像这样重新编译 git:
./configure --with-curl --with-expat
Run Code Online (Sandbox Code Playgroud)
但仍然出现致命错误。
最后,经过几个令人沮丧的小时后,我阅读了配置文件,看到了:
# 定义 CURLDIR=/foo/bar 如果你的 curl 头文件和库文件在
# /foo/bar/include 和 /foo/bar/lib 目录。
我记得那时我没有curl从源代码中遵守,所以去寻找头文件。果然,他们没有安装。那就是问题所在。Make 没有抱怨缺少头文件。所以我没有意识到该--with-curl选项什么也没做(实际上是我的 版本中的默认设置git)。
我做了以下修复:
添加了 make 所需的标题:
yum install curl-devel
(expat-devel-1.95.8-8.3.el5_5.3.i386 was already installed).
Run Code Online (Sandbox Code Playgroud)git从/usr/local(因为我希望新安装存在于那里)中删除。
我只是git*从/usr/local/share和/usr/local/libexec
搜索包含头文件curl和expat头文件的包含目录,然后(因为我已经通读了configure)将它们添加到环境中,如下所示:
export CURLDIR=/usr/include
export EXPATDIR=/usr/include
Run Code Online (Sandbox Code Playgroud)冉configure用下列选项,其中,再一次,在描述configure文件本身,并且也是默认值,但究竟发生了什么:
./configure --with-curl --with-expat
Run Code Online (Sandbox Code Playgroud)而现在http的作品与git通过我的企业防火墙:
git clone http://github.com/miksago/node-websocket-server.git
Cloning into 'node-websocket-server'...
* Couldn't find host github.com in the .netrc file, using defaults
* About to connect() to proxy proxy.entp.attws.com port 8080
* Trying 135.214.40.30... * connected
...
Run Code Online (Sandbox Code Playgroud)git config --global http.proxy http://user:password@domain:port
Run Code Online (Sandbox Code Playgroud)
git config --global http.proxy http://clairton:123456@proxy.clairtonluz.com.br:8080
Run Code Online (Sandbox Code Playgroud)
只是发布这个,因为它是谷歌的第一个结果,我发现这篇博文通过更新卷曲证书解决了我的问题.
http://www.simplicidade.org/notes/archives/2011/06/github_ssl_ca_errors.html
小智 5
这对我有用。
git config --global http.proxy proxy_user:proxy_passwd@proxy_ip:proxy_port
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
687762 次 |
| 最近记录: |