Install Git on the server

You can view the git version git --versionCopy the code

I have been failed to install, do not know why, if there is a god know, please advise. So I used the following steps to install Git

1. Access the git official website

2. Find the version you need

3. Right-click gz or xz and copy the link address
4. Wget + link address download

Wget HTTP: / / https://www.kernel.org/pub/software/scm/git/git-2.35.1.tar.gz

5. The decompression

The tar - ZXF git - 2.35.1. Tar. Gz

6. Installation

/configure –prefix=/usr/local/ build and install: make && make install

7. Check the

git --version

The git version 2.35.1

Successful installation

Two, pagoda installation webhook

Three, click Settings – Add – enter a name and execute the script

Execute the script, there are two place need to modify the gitPath = "/ WWW/below $1" (pay attention to your ali cloud file path, if you don't need to modify) gitHttp = "https://gitee.com/yourname/$1.git" (pay attention to your remote warehouse address)Copy the code
#! Date --date='0 days ago' "+%Y-%m-%d %H:% m :%S" echo "Start"  -n "$1" ]; Git gitPath="/ WWW /wwwroot/$1 GitHttp = "https://gitee.com/yourname/$1.git" echo "Web site path: $gitPath #" to determine whether a project path exists if [-d "$gitPath"]; If [! -d ".git"]; if [! -d ".git"]; Git clone $gitHttp gittemp mv gittemp/.gittemp Chown -r WWW: WWW $gitPath echo "End" exit else echo "The project path does not exist" echo "End" exit fiCopy the code

Configure the remote warehouse

Pagoda panel, open webhook keyRemote repository, WebHook configuration

To avoid git pull, add the username and password first

CD/WWW/below/under / / CD to your own directory git clone https://gitee.com/yourname/ own project name. Git git config - global user. The name "user name" git Git config --global credential.helper store [user] name = entered user name email = entered mailbox [credential] helper = store // The user name and password git pull will be prompted for the first pull Username for 'https://gitee.com': [email protected] Password for 'https://[email protected]@gitee.com': Enter the correct Password // generate git-credentials Hide the file cat ~/. Git-credentials https://Username:[email protected] vi ~ /. Git - credentials can add multiple usernames and passwordsCopy the code

Finally, change the site root directory to the dist folder.

Note: If the site root directory on the Pagoda panel is the dist folder, remember to modify the local.gitignore file

This way, when you git push master from the local repository to the remote repository, the dist folder code is automatically published online

View WebHook logs