在使用 git clone http://10.0.13.2/project 时系统提示如下图所示错误


The requested URL returned error: 401(curl_result = 22, http_code = 401 ....)
从http_code = 401 可以看出是因为authorization的问题,虽然已经提示了输入username和password,但在多次获取时并未将之前录入的username和password保存下来。
解决办法有二:
一、在$HOME下创建 _netrc文件,在其中写入如下内容
  machine 10.0.13.2
  login your_username
  password your_password
二、在执行命令式直接提供username和password,如下
   将git clone http://10.0.13.2/project 替换成
   git clone http://username:password@10.0.13.2/project

 

参考资料:
http://stackoverflow.com/questions/5796171/git-clone-over-https-401-error-and-not-asking-for-username-or-password
http://stackoverflow.com/questions/4980912/username-and-password-in-https-url

arrow
arrow
    全站熱搜

    zer931 發表在 痞客邦 留言(0) 人氣()