升级MacOS Catalina10.15导致SVN或Git报错解决方案

最近把Mac升级到最新10.15版本导致SVN或GIT导项目时报错具体报错如下:

Git doesn't work on MacOS Catalina: “xcrun: error: invalid active developer 
path (/Library/Developer/CommandLineTools), missing” [duplicate]

在stackoverflow找到解决方案:

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

没权限记得加上sudo