简体   繁体   English

git push仅在`sudo`下有效

[英]git push will only work under `sudo`

When I try to push a git repository to github : 当我尝试push git存储库push送到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

I tried to use sudo : 我尝试使用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.

I'm so surprised that it works under sudo , (it also require me to input github account name and password.) What's wrong here and how can I set up this without using sudo ? 我很惊讶它可以在sudo下工作((这还要求我输入github帐户名和密码。)这是怎么回事,如何在不使用sudo情况下进行设置?

Software environment: 软件环境:

➜  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) 

Once you have determined which certificates file (as mentioned by Guildencrantz ) you are using: 确定了哪个证书文件(如Guildencrantz所述 )后,您将使用:

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

do (without sudo) 做(没有须藤)

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

If the push works, set that for all repos: 如果推送有效,请为所有存储库设置该推送:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM