웹마짱구의 블로그

git 서버 만들기

Git2020. 3. 24. 18:21
728x90

참고1:https://git-scm.com/book/ko/v2/Git-%EC%84%9C%EB%B2%84-%EC%84%9C%EB%B2%84-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0

참고2: https://www.youtube.com/watch?v=sAeXpcGCQfI

 

[서버]

$ mkdir git_test

$ cd git_test

$ git init --bare remote

$ cd remote

 

[hooks/post-receive]

#!/bin/bash
TARGET="/home/web/deploy"
GIT_DIR="/home/web/remote"
BRANCH="master"

while read oldrev newrev ref
do
# only checking out the master (or whatever branch you would like to deploy)
if [ "$ref" = "refs/heads/$BRANCH" ];
then
echo "Ref $ref received. Deploying ${BRANCH} branch to production..."
git --work-tree=$TARGET --git-dir=$GIT_DIR checkout -f $BRANCH
else
echo "Ref $ref received. Doing nothing: only the ${BRANCH} branch may be deployed on this server."
fi
done

 

[클라이언트]

$ git init local

$ cd local

$ git config --global user.email "you@example.com"
$ git config --global user.name "Your Name"

$ vi f1.txt

$ git add f1.txt

$ git commit -m 1

$ git remote add origin ssh://jjangu@192.168.1.20/home/jjangu/git_test/remote/

$ git remote -v

origin  ssh://jjangu@192.168.1.20/home/jjangu/git_test/remote/ (fetch)
origin  ssh://jjangu@192.168.1.20/home/jjangu/git_test/remote/ (push)

$ git push origin master

 

728x90

원문 : https://www.alibabacloud.com/help/doc-detail/42205.htm

 

Get real client IP address - Website Access| Alibaba Cloud Documentation Center

In many cases, a visitor’s browser is not directly connected to the server for website access because CDN, WAF, or Anti-DDoS Pro is deployed in between. For example, the following is a common architecture: Client > CDN/WAF/Anti-DDoS Pro > Origin server. He

www.alibabacloud.com

Nginx

1. Install http_realip_module.

Apache

Windows system

The Apache 2.4 or higher versions have the remoteip_module file ( mod_remoteip.so) in the installation package. You can use this file to get the real client IP address.

 

Linux system

You can get the real client IP address by installing the third-party module mod_rpaf.

 

아파치 모듈 적용
Apache 2.2 이하버전은 mod_rpaf
Apache 2.4 버전은mod_remoteip

 

 

so 파일 다운로드 https://www.pconlife.com/viewfileinfo/mod-remoteip-so/

728x90

원문 : https://crivius.tistory.com/12

 

[PHP] sprintf(), printf() 사용법 - 형식화 문자열 반환

sprintf(format,arg1,arg2,arg++) sprintf () 함수는 변수에 서식 첨부 캐릭터 라인을 기록합니다. ARG1, ARG2, arg++는 "단계별"작동한다. 첫 번째 % 기호는 ARG1로 두 번째 % 기호는 ARG2로 format, arg1은 필..

crivius.tistory.com

 

 

sprintf(format,arg1,arg2,arg++)

 

sprintf () 함수는 변수에 서식 첨부 캐릭터 라인을 기록합니다.

ARG1, ARG2, arg++는  "단계별"작동한다. 첫 번째 % 기호는 ARG1로 두 번째 % 기호는 ARG2로

 

format, arg1은 필수인자이고 arg2,arg++ 선택적인자이다.

 

 

%% - 백분율 기호를 반환합니다.
% b - 이진수
% c - ASCII 값에 따른 문자
% d - 부호있는 10 진수 (음수, 0 또는 양수)
% e - 소문자 (예 : 1.2e + 2)를 사용하는 과학 표기법
% E - 대문자 (예 : 1.2E + 2)를 사용하는 과학 표기법
% u - 부호없는 10 진수 (0보다 크거나 같음)
% f - 부동 소수점 수 (로컬 설정 인식)
% F - 부동 소수점 수 (로컬 설정 인식 없음)
% g - % e와 % f 중 짧은 것
% G - % E 및 % f 중 더 짧음
% o - 8 진수
% s - 문자열
% x - 16 진수 (소문자)
% X - 16 진수 (대문자)

 

추가적인 형식 = %와 문자사이에 추가형식이 배치가능 (예 : %.2f)

 

예1)

1

2

3

4

5

6

$str = "홍길동";

$num1 = 10000;

$num2 = 12;

$txt = sprintf("%s님 %u원 쿠폰 사용기간이 %u일 남았습니다.",$str,$num1,$num2);

echo $txt;   // 결과  홍길동님 10000원 쿠폰 사용기간이 12일 남았습니다.

 

 

 

예2) 소수점 몇째자리까지 표현해줄지 설정

1

2

3

$num = 123.123;

$txt = sprintf("%.2f",$num);

echo $txt; // 결과 123.12

 

 

예3) 달력의 한자리수인 월앞에 0을 붙일 경우

1

2

3

$num = 3;

$txt = sprintf("%02d",$num);

echo $txt;  // 결과 03

 

printf() 함수는 sprintf()와 사용법은 동일하다.

printf()는 결과를 출력하고 sprintf()는 결과를 리턴한다.(echo를 해주고 안 해주고 차이)

728x90

원문 : https://dreamlog.tistory.com/76

 

apt-get update에서 발생하는 GPG public key 오류 해결 방법.

Linux를 사용 중 프로그램을 설치와 삭제를 반복하면 아래와 같은 오류가 발생한다. W: GPG 오류: http://ppa.launchpad.net natty Release: 다음 서명들은 공개키가 없기 때문에 인증할 수 없습니다: NO_PUBKEY X..

dreamlog.tistory.com

 

현상 : W: GPG 오류: http://ppa.launchpad.net natty Release: 다음 서명들은 공개키가 없기 때문에 인증할 수 없습니다: NO_PUBKEY XXXXXXXXXXXXXXXXXX

해결 : sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys XXXXXXXXXXXXXXXXXX


728x90

원문 : http://enjoystat.epizy.com/blog/2017/03/17/%EC%9A%B0%EB%B6%84%ED%88%AC-%ED%8C%A8%ED%82%A4%EC%A7%80-%EC%97%85%EB%8D%B0%EC%9D%B4%ED%8A%B8-%EC%98%A4%EB%A5%98-%ED%95%B4%EA%B2%B0/?i=1

 

우분투 패키지 업데이트 오류 해결 – Ubuntu 활용

$ sudo -i # apt-get clean # cd /var/lib/apt # mv lists lists.old # mkdir -p lists/partial # apt-get clean # apt-get update # exit $

enjoystat.epizy.com

 

$ sudo -i
# apt-get clean
# cd /var/lib/apt
# mv lists lists.old
# mkdir -p lists/partial
# apt-get clean
# apt-get update
# exit
$