使用 ssh 访问git1、在服务器生成 ssh 密钥对。1.2、使用 https 访问 git 可以使用 https://username:password@git地址设置地址,1.2、或者执行 git config credential.helper store 然后手动拉一下代码,填写密码后会自动存储。2、把公钥添加到 码云 的 ssh key 中。3、编写 pull 代码的脚本。 关于 pull 脚本,使用什么语言都可以,但是需要注意权限。 比如新建一个 pull.php echo `git pull origin master`; echo `chown -R www:www .`; 然后使用 php -S 0.0.0.0:9999 启动它,现在防火墙放行,9999 端口,在外网访问查看效果。 在 码云的 web hook 选择 push event 然后填写 `服务器地址:9999/pull.php`。
使用 ssh 访问git
1、在服务器生成 ssh 密钥对。
1.2、使用 https 访问 git 可以使用
https://username:password@git地址
设置地址,1.2、或者执行
git config credential.helper store
然后手动拉一下代码,填写密码后会自动存储。2、把公钥添加到 码云 的 ssh key 中。
3、编写 pull 代码的脚本。
关于 pull 脚本,使用什么语言都可以,但是需要注意权限。
比如新建一个 pull.php
然后使用