»
(008)CubeIDE实现USB外设*
(018)C99 的指针*
(019)C99 只有值赋值,没有move*
(022)POSIX线程库pthread的同步锁*
(023)POSIX线程库pthread的多线程*
(027)C99标准库中的计时与等待 *
(028)C语言中的高精度计算库GMP *
(029)C语言中的Web服务*
(030)C语言中的字符转码ICU*
(031)从几个方面显然C语言比C++效率高*
🍓(013)Git禁止强制推送
Git禁止用户强制推送的方法:
cd /path/to/repo.git/hooks
touch pre-receive
chmod +x pre-receive
#!/bin/bash
# 读取标准输入,获取引用更新信息
while read old_ref new_ref ref_name; do
echo "Received push:"
echo "Old ref: $old_ref"
echo "New ref: $new_ref"
echo "Ref name: $ref_name"
# 示例:禁止强制推送
if [ "$old_ref" = "0000000000000000000000000000000000000000" ]; then
echo "ERROR: Force push is not allowed."
exit 1
fi
# 示例:禁止删除分支
if [ "$new_ref" = "0000000000000000000000000000000000000000" ]; then
echo "ERROR: Deleting branches is not allowed."
exit 1
fi
done
# 如果脚本正常退出(返回 0),则允许推送
exit 0
来自:DeepSeek