如何让git使用代理服务器?
我需要从git服务器检出代码,每次都显示"Request timed out".我该如何解决这个问题?
或者,如何设置代理服务器?
注意:虽然描述的用例是关于在项目中使用子模块,但同样适用于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).
我有两个远程git存储库.origin和github
我将我的分支推devel送到两个存储库.
git push -u origin devel
git push -u github devel
Run Code Online (Sandbox Code Playgroud)
但是,当我这样做的时候.git push它只会被推到github.
无论如何我可以设置我的两个遥控器,以便我可以用一个命令将更改推送到两个存储库?
我有git代理配置为'http.proxy = http:// userId:pwd @ 123 @ipaddress:port'但是在克隆远程项目时,我收到错误
Cloning into git...
error: Couldn't resolve proxy '123@ipaddress' while accessing http://git.kernel.org/pub/scm/git/git.git/info/refs
fatal: HTTP request failed
Run Code Online (Sandbox Code Playgroud)
如何逃避密码中的'@'字符?
请注意:我无法更改密码.
如何让git使用socks代理进行http传输?
我成功地使用GIT_PROXY_COMMAND配置git以使用socks代理进行GIT传输.
此外,我已经配置我的.curlrc文件来定义socks代理,我可以直接用curl命令获取信息,如:
curl http://git.kernel.org/pub/scm/git/git.git/info/refs?service=git-upload-pack
Run Code Online (Sandbox Code Playgroud)
但是如何使用带git的socks代理来使用http传输协议检索数据,如:
git clone http://git.kernel.org/pub/scm/git
Run Code Online (Sandbox Code Playgroud) 我在Windows上使用Git,在公司网络上,我使用基本身份验证的HTTP代理.出站SSH不起作用,因此我必须通过代理使用HTTPS.
我知道如何使用git config http.proxy配置设置http://[username]:[password]@[proxy]:[port].
但是,特别是因为这是一台共享机器,我宁愿不将我的密码存储在我的.gitconfig.另外,更改我.gitconfig使用git config命令会在我的bash历史记录中留下我的密码,所以即使我记得.gitconfig在会话结束时清除我,我几乎肯定会忘记清除我的历史记录.
我试过设置http.proxy没有密码,徒劳地希望我在尝试推/拉时提示我输入密码,但我只需要407代理身份验证.我在网上找到的所有信息似乎都忽略了以明文形式保存密码的问题.gitconfig,或者处理NTLM代理.
我很乐意在每次需要连接时输入我的代理详细信息 - 目前我能看到的最佳解决方案是编写一个包装脚本,提示我输入密码并在调用时将其设置为环境变量git.这是一个不错的解决方案,并且在脚本中为单个调用设置环境变量是否有任何安全隐患?最好是否有可用于此的内置设置或现有工具?
我有一个使用自签名证书通过https工作的企业git服务器.本地克隆包含两个遥控器 - 指向该服务器的原点,另一个指向github.默认情况下从原点拉出失败:
$ git pull
fatal: unable to access 'https://user@code.example.com/git/fizzbuzz.git/': SSL certificate problem: self signed certificate
Run Code Online (Sandbox Code Playgroud)
github遥控器工作正常.
有两种经常建议的解决方案:
git config http.sslVerify false
Run Code Online (Sandbox Code Playgroud)
这是一个坏主意,并且在配置Git中建议接受特定https远程的特定自签名服务器证书:
git config http.sslCAInfo <downloaded certificate>.pem
Run Code Online (Sandbox Code Playgroud)
修复了从原点拉动,但打破了github远程:
$ git pull github
fatal: unable to access 'https://github.com/user/fizzbuzz.git/': SSL certificate problem: unable to get local issuer certificate
Run Code Online (Sandbox Code Playgroud)
如何在不破坏github的情况下从公司服务器上工作?
我在公司防火墙后面使用git,并且我使用http.proxy --global config成功克隆了外部项目.
当我想在Intranet上通过http克隆时,我的问题出现了.我怀疑代理配置会干扰Intranet请求.
我知道我可以在使用内部网之前重置配置,但这不是非常用户友好.
我也看到了这个答案,但它似乎只适用于现有的存储库.
有没有办法只为一个命令调用停用代理使用?在这种情况下,初始克隆?
克隆我的回购工作; 推回去没有.
第一次克隆不起作用:
git clone https://github.com/slimsnerdy/testy.git
Cloning into 'testy'...
fatal: unable to access 'https://github.com/slimsnerdy/testy.git/': SSL certificate problem: self signed certificate in
certificate chain
Run Code Online (Sandbox Code Playgroud)
所以我在.gitconfig文件中添加了以下自定义证书:
[http]
sslCAInfo = U:/ca-bundle.crt
Run Code Online (Sandbox Code Playgroud)
现在克隆工作:
Cloning into 'testy'...
remote: Counting objects: 25, done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 25 (delta 8), reused 6 (delta 1), pack-reused 0
Unpacking objects: 100% (25/25), done.
Run Code Online (Sandbox Code Playgroud)
好了现在推动:
new-item test.txt
git add *
git commit -m "push test"
git push
Username for 'https://github.com': slimsnerdy
Password for …Run Code Online (Sandbox Code Playgroud) 我收到错误 403:
发生错误。详细信息:响应状态码不表示成功:403(禁止)。
尝试使用 Visual Studio 团队资源管理器推送或同步未同步提交时。
例如,当使用命令行或 sourcetree 时,一切正常。有没有人以前遇到过这个错误并找到解决方法?
我没有使用 ssh。
谢谢!