go get 安装依赖踩坑

在go get或go mod download时,可能会依赖一些其他地方的库或是自己的git库,此时需要更改证书和配置git。

一. 证书安装
有些服务器需要配置证书,不同的系统有不同的添加证书方法

Mac OS X

1. add:
	sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/new-root-	certificate.crt
2. Remove
	sudo security delete-certificate -c "<name of existing certificate>"

Windows

1. add:
	certutil -addstore -f "ROOT" new-root-certificate.crt
2. remove:
	certutil -delstore "ROOT" serial-number-hex

Linux (Ubuntu, Debian):

1. add:
	a. Copy your CA to dir /usr/local/share/ca-certificates/
	b. Use command: sudo cp foo.crt /usr/local/share/ca-certificates/foo.crt
	c. Update the CA store: sudo update-ca-certificates
2. remove
 	a. Remove your CA.
	b. Update the CA store: sudo update-ca-certificates --fresh

Linux (CentOs 6)

1. Add	
	1. Install the ca-certificates package: yum install ca-certificates
	2. Enable the dynamic CA configuration feature: update-ca-trust force-enable
	3. Add it as a new file to /etc/pki/ca-trust/source/anchors/: cp foo.crt /etc/pki/ca-trust/source/anchors/
	4. Use command: update-ca-trust extract

Linux (CentOs 5)

 Add	
	1. Append your trusted certificate to file /etc/pki/tls/certs/ca-bundle.crt
	2. cat foo.crt >>/etc/pki/tls/certs/ca-bundle.crt

二. 生成ssh访问密钥

$ ssh-keygen -t rsa
# 生成的文件在~/.ssh/下, 包含id_rsa,id_rsa.pub前者为私钥,后者为公钥,公钥放到自建git库的sshkey中。
$ chmod 600 ~/.ssh/id_rsa

二. git 配置

git config --global url.git@git.xx.com:.insteadOf https://git.xx.com/ #表示将ssh访问git库转为https访问
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值