我在 MacBook Pro 上使用 git 已经很多年了,也安装了 xcode,但很少使用它。昨天不小心打开了xcode,立马关掉了。然后,我的 docker 环境中的 git 命令停止工作(git 无法检测到该目录是 git repo),所以我回到常规环境并输入 git status,并看到以下消息
You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.
Press the 'return' key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/en.lproj/License.rtf'
Run Code Online (Sandbox Code Playgroud)
如果我运行which git输出是/usr/bin/git- 这可能是 xcode 安装的 git 版本吗?发生了什么?如何恢复原来的 git 安装?谢谢
我知道这里有很多这个问题的副本,但他们的所有答案都建议添加
ZSH_DISABLE_COMPFIX="true"
Run Code Online (Sandbox Code Playgroud)
到我的 ~/.zshrc 文件的顶部。我已经这样做了,但每次打开 zsh 时,我都会受到欢迎
zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]?
Run Code Online (Sandbox Code Playgroud)
似乎其他问这个问题的人在第一个样本中没有引用真实的引号,但我已经添加了。我还运行了 source ~/.zshrc 据我所知,它重新加载了 zshrc 配置。这仍然给了我上述警告。我不确定这些细节中的任何一个是否相关,但我会包括它们:
知道如何解决此权限问题吗?谢谢
编辑:
comaudit 回报
/usr/local/share/zsh/site-functions
/usr/local/share/zsh
Run Code Online (Sandbox Code Playgroud)
此外,这里是我的 ~/.zshrc 文件中的其他非标准条目(按顺序排列,但中间有一些内置内容):
ZSH_DISABLE_COMPFIX="true"
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
export PATH="/usr/local/opt/icu4c/bin:$PATH"
export PATH="/usr/local/opt/icu4c/sbin:$PATH"
export PATH=$HOME/bin:/usr/local/bin:$PATH
plugins=(git)
source $ZSH/oh-my-zsh.sh
zstyle :compinstall filename '/Users/jonahsaltzman/.zshrc'
# End …Run Code Online (Sandbox Code Playgroud) 我有一个函数time
const time = <T>(fn: (...args: any[]) => Promise<T>, ...args: any[]): Promise<T> => {
return new Promise(async (resolve, reject) => {
const timer = setTimeout(() => reject(`Error: ${fn.name} timed out`), ms)
try {
resolve(await fn.bind(thisArg)(...args))
} catch(err) {
reject(err)
} finally {
clearTimeout(timer)
}
})
}
Run Code Online (Sandbox Code Playgroud)
我想知道是否有办法避免使用anyas 的类型...args?具体来说,因为我想将签名 ( )...args中的类型与(函数的第二个参数)的类型相关联。这两个是相同的参数,所以看起来它们应该通过泛型相关。我想到了这样的事情:fnfn: (...args: any[]) => Promise<T>...argstime...args
const time = <T, U>(fn: (...args: U[]) => Promise<T>, ...args: U[]): Promise<T>
Run Code Online (Sandbox Code Playgroud)
但这似乎是错误的,因为参数并不都是同一类型。...args …