git push只能在`sudo`

时间:2015-12-27 02:55:43

标签: git ssl openssl

当我尝试push git存储库到github时:

julia_proj git:(master) git push -u origin master
fatal: unable to access 'https://github.com/nickleeh/julia_proj.git/': SSL certificate problem: unable to get local issuer certificate

我尝试使用sudo

julia_proj git:(master) sudo git push -u origin master
[sudo] password for nick: 
Username for 'https://github.com': nickleeh
Password for 'https://nickleeh@github.com': 
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 373 bytes | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To https://github.com/nickleeh/julia_proj.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

我很惊讶它在sudo下工作,(它还要求我输入github帐户名和密码。)这里有什么问题以及如何在不使用的情况下设置它sudo

软件环境:

➜  julia_proj git:(master) uname -a
Linux nick-thinkpad 4.2.5-1-ARCH #1 SMP PREEMPT Tue Oct 27 08:13:28 CET 2015 x86_64 GNU/Linux
➜  julia_proj git:(master) git --version
git version 2.6.4
➜  julia_proj git:(master) 

1 个答案:

答案 0 :(得分:1)

确定您正在使用的证书文件(如Guildencrantz所述):

 curl -sv https://github.com/ 2>&1 >/dev/null | grep 'CAfile'

做(没有sudo)

cd /path/to/your/local/repo
git config http.sslCAInfo /path/to/certificates

如果推送有效,请为所有回购设置:

cd /any/path/you/want
git config --global http.sslCAInfo /path/to/certificates