Hướng dẫn vô hiệu hoá Disable SSL trong GIT

1. SSL Certificate trong GIT là gì?

SSL certificate trong Git là một chứng chỉ SSL (Secure Sockets Layer) được sử dụng để bảo vệ dữ liệu giao tiếp giữa máy tính của bạn và máy chủ Git. Khi bạn thực hiện các hoạt động như clone, push hoặc pull từ một kho lưu trữ Git (như GitHub, GitLab, Bitbucket), dữ liệu được truyền qua mạng công cộng. Sử dụng SSL certificate đảm bảo rằng dữ liệu của bạn được mã hóa và an toàn trên đường truyền, ngăn chặn nguy cơ bị tấn công từ người thứ ba.

2. Cách vô hiệu hoá Disable SSL trong GIT?

Cách 1:

Sử dụng câu lệnh git config

Chỉ vô hiệu hóa kiểm tra SSL cho Repo hiện tại / Disable SSL certificate

git config http.sslVerify false

Vô hiệu hóa kiểm tra SSL cho toàn bộ Repo / Disable SSL certificate checking for all repo

git config –global http.sslVerify false

Sử dụng biến môi trường GIT_SSL_NO_VERIFY

Khi thực hiện clone repo, chúng ta sử dụng biến môi trường GIT_SSL_NO_VERIFY để vô hiệu hóa kiểm tra Certificate

GIT_SSL_NO_VERIFY=true git clone –recursive https://github.com/vinasupport/xxx.git

Sửa file config của GIT

Tới thư mục cài đặt của Git: vd: C:\Program Files (x86)\Git\etc (trên Windows) hoặc ~/.gitconfig (Linux)

Sửa file .gitconfig

Dưới section [http] thêm dòng sslVerify = false

  • [http]
  • sslVerify = false
Cách 2:

– Check api pod:

# oc get pod |grep files
asset-files-api-7c5c776677-phd4f 1/1 Running 0 5d21h

– Tiến hành sao lưu cài đặt:

# oc get deploy asset-files-api -o yaml > /tmp/asset-files-api-deploy-9827.yaml
# cat /tmp/asset-files-api-deploy-9827.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
cloudpakId: eb9998dcc5d24e3eb5b6fb488f750fe2
cloudpakName: IBM Cloud Pak for Data
deployment.kubernetes.io/revision: “2”

– Chỉnh sửa triển khai sset-files-api-deploy:

# oc edit deploy asset-files-api

– Thêm cài đặt sau:

Trước:


image: image-registry.openshift-image-registry.svc:5000/zen/asset-files-api:v3.5.5_080621
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 5

Sau:


image: image-registry.openshift-image-registry.svc:5000/zen/asset-files-api:v3.5.5_080621
imagePullPolicy: IfNotPresent
lifecycle:
postStart:
exec:
command:
– /bin/sh
– -c
– git config –global http.sslCAInfo /etc/certificate/certificate.pem;
git config –global user.email “@bhp.com”
livenessProbe:
failureThreshold: 5

Lưu quá trình triển khai và xác nhận nhóm mới đang hoạt động:

# oc get pod |grep files
asset-files-api-657f7d4d5-gwm82 0/1 Running 0 18s
asset-files-api-7c5c776677-phd4f 1/1 Running 0 5d21h

3. Kết luận:

Ok trên đây là bài viết hướng dẫn về: Cách vô hiệu hoá Disable SSL trong GIT – chúc các bạn thành công

0/5 (0 Reviews)

Leave a Comment