我最近切换到将我的存储库同步到GitHub上的https://(由于防火墙问题),并且每次都要求输入密码.过去,我有一个SSH证书,这就足够了.在我的情况下是否有办法绕过密码(使用http/https)?
我从我的Github帐户克隆了一个git存储库到我的电脑.
我想使用我的PC和笔记本电脑,但有一个Github帐户.
当我尝试使用我的PC从Github推送或拉出时,它需要用户名和密码,但在使用笔记本电脑时则不需要!
每次与原点交互时,我都不想输入用户名和密码.我在这里缺少什么?
注意:虽然描述的用例是关于在项目中使用子模块,但同样适用于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 push origin master我收到此错误:
git: 'credential-cache' is not a git command. See 'get --help'.
Run Code Online (Sandbox Code Playgroud)
...此时我被迫输入我的用户名和密码.这样做之后,我再次收到相同的错误消息,然后是输出git push.
这是我的.gitconfig文件的内容:
[user]
name = myusername
email = myusername@myemaildomain.com
[credential]
helper = cache
Run Code Online (Sandbox Code Playgroud)
要清楚,在我安装Git并运行Git Bash之后,这就是我输入的内容:
git config --global user.name "myusername"
git config --global user.email "myusername@myemaildomain.com"
git config --global credential.helper cache
Run Code Online (Sandbox Code Playgroud)
请帮忙.这太令人沮丧了!