我想git clone https://github.com/org/project.git
在CentOS盒子上做一个简单但是得到:
错误:请求的URL在访问https://github.com/org/project.git/info/refs时返回错误:401
致命:HTTP请求失败
它永远不会提示我输入我的用户名/密码,只是失败了.
我可以在我的Mac上拨打完全相同的电话没问题 - 我错过了什么?
Yar*_*rin 207
答案很简单但不明显:
代替:
git clone https://github.com/org/project.git
Run Code Online (Sandbox Code Playgroud)
做:
git clone https://username@github.com/org/project.git
Run Code Online (Sandbox Code Playgroud)
或(不安全)
git clone https://username:password@github.com/org/project.git
Run Code Online (Sandbox Code Playgroud)
(请注意,在后一种情况下,您的计算机上的其他用户可以通过运行ps u -u $you
显示您的密码,默认情况下,您的密码会在shell的历史记录中显示为明文)
所有3种方式都适用于我的Mac,但只有最后2种方法适用于远程Linux机器.(回想一下,这可能是因为我在我的Mac上设置了一个全局git用户名,而在远程盒子上我没有设置?那可能就是这种情况,但是缺少用户名的提示让我感到震惊.. .)
没有在任何地方看到这个记录,所以在这里.
Chu*_*Lai 32
您可以手动禁用ssl verfiy,然后重试.:)
git config --global http.sslverify false
Run Code Online (Sandbox Code Playgroud)
小智 10
我必须指定用于1.7.1 git版本的用户名:
git remote set-url origin https://username@github.com/org/project.git
Run Code Online (Sandbox Code Playgroud)
小智 9
我遇到了同样的问题,错误消息和操作系统信息如下
操作系统信息:
CentOS版本6.5(最终版)
Linux 192-168-30-213 2.6.32-431.el6.x86_64#1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU / Linux
错误信息:
初始化/home/techops/pyenv/.git/中的空Git存储库密码:错误:访问https://waterdrops@github.com/pyenv/pyenv.git/info/refs时出错
致命:HTTP请求失败
git&curl版本信息
git info:git版本1.7.1
curl 7.19.7(x86_64-redhat-linux-gnu)libcurl / 7.19.7 NSS / 3.14.0.0 zlib / 1.2.3 libidn / 1.18 libssh2 / 1.4.2协议:tftp ftp telnet dict ldap ldaps http文件https ftps scp sftp功能:GSS协商IDN IPv6大文件NTLM SSL libz
调试
$ curl-详细https://github.com
- 即将connect()到github.com端口443(#0)
- 尝试连接13.229.188.59 ...
- 连接到github.com(13.229.188.59)端口443(#0)
- 使用certpath初始化NSS:sql:/ etc / pki / nssdb
- CAfile:/etc/pki/tls/certs/ca-bundle.crt CApath:无
- NSS错误-12190
TLS握手中的错误,正在尝试SSLv3 ... GET / HTTP / 1.1 User-Agent:curl / 7.19.7(x86_64-redhat-linux-gnu)libcurl / 7.19.7 NSS / 3.14.0.0 zlib / 1.2.3 libidn / 1.18 libssh2 / 1.4.2主机:github.com接受:/
连接已终止,请重新尝试重新连接
- 关闭连接#0
- 对此URL发出另一个请求:“ https://github.com ”
- 即将connect()到github.com端口443(#0)
- 尝试连接13.229.188.59 ...
- 连接到github.com(13.229.188.59)端口443(#0)
- 由于先前的握手失败,TLS被禁用
- CAfile:/etc/pki/tls/certs/ca-bundle.crt CApath:无
- NSS错误-12286
- 关闭连接#0
- SSL连接错误卷曲:(35)SSL连接错误
在升级curl,libcurl和nss之后,git clone再次可以正常工作,所以就在这里。更新命令如下
须藤百胜更新-y nss curl libcurl
正如JERC所说,请确保您拥有更新版本的git.如果您只使用默认设置,当您尝试安装git时,您将获得1.7.1版.除了手动下载和安装最新版本的get之外,您还可以通过向yum添加新存储库来实现此目的.
来自tecadmin.net:
下载并安装rpmforge存储库:
# use this for 64-bit
rpm -i 'http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm'
# use this for 32-bit
rpm -i 'http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm'
# then run this in either case
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
Run Code Online (Sandbox Code Playgroud)
然后你需要启用rpmforge-extras.编辑/etc/yum.repos.d/rpmforge.repo
和更改enabled = 0
到enabled = 1
下[rpmforge-extras]
.该文件如下所示:
### Name: RPMforge RPM Repository for RHEL 6 - dag
### URL: http://rpmforge.net/
[rpmforge]
name = RHEL $releasever - RPMforge.net - dag
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/rpmforge
mirrorlist = http://mirrorlist.repoforge.org/el6/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
[rpmforge-extras]
name = RHEL $releasever - RPMforge.net - extras
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/extras
mirrorlist = http://mirrorlist.repoforge.org/el6/mirrors-rpmforge-extras
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-extras
enabled = 0 ####### CHANGE THIS LINE TO "enabled = 1" #############
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
[rpmforge-testing]
name = RHEL $releasever - RPMforge.net - testing
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/testing
mirrorlist = http://mirrorlist.repoforge.org/el6/mirrors-rpmforge-testing
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-testing
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
Run Code Online (Sandbox Code Playgroud)
完成此操作后,您可以使用更新git
yum update git
Run Code Online (Sandbox Code Playgroud)
我不确定为什么,但他们建议禁用rpmforge-extras(更改回enabled = 0
)然后运行yum clean all
.
您很可能需要使用sudo
这些命令.
小智 6
经过一段时间后,我能够得到一个git 1.7.1.
首先,我必须禁用SSL,以便我可以拉:
git config --global http.sslverify false
Run Code Online (Sandbox Code Playgroud)
然后我可以克隆
git clone https://github.com/USERNAME/PROJECTNAME.git
Run Code Online (Sandbox Code Playgroud)
然后在添加和提交后,我无法撤回.所以我做了
git remote -v
origin https://github.com/USERNAME/PROJECTNAME.git (fetch)
origin https://github.com/USERNAME/PROJECTNAME.git (push)
Run Code Online (Sandbox Code Playgroud)
看到拉动和推动地址:
必须使用USERNAME @修改这些内容
git remote set-url origin https://USERNAME@github.com/USERNAME/PROJECTNAME.git
Run Code Online (Sandbox Code Playgroud)
它仍然会提示您输入密码,您可以添加密码
USERNAME:PASSWORD@github.....
Run Code Online (Sandbox Code Playgroud)
但请不要这样做,因为您以明文形式保存密码以便轻松盗窃.
由于防火墙的限制,我无法使SSH工作,因此我不得不这样做.
归档时间: |
|
查看次数: |
115257 次 |
最近记录: |