Git询问SSH密钥密码

时间:2019-06-23 14:13:32

标签: git ssh

我正在使用Git从Github克隆我的存储库。我正在使用HTTPS克隆它。

每次我cd到存储库,或者我执行的每个命令时,终端都会问我我的SSH密钥密码。这很奇怪,因为我没有使用SSH连接到Github。

如果我键入SSH密钥密码,终端将挂起。如果我只是忽略它(按回车键),那么一切都很好,但是它总是在每个新命令中询问我的SSH密码。

我不知道这可能是什么,我在两个包含javascript代码的存储库中遇到了这个问题。

预先感谢

编辑:git config --show-origin -l返回以下内容:

file:/usr/local/etc/gitconfig   credential.helper=osxkeychain
file:/Users/otaviobonder/.gitconfig     user.name=Otavio Bonder
file:/Users/otaviobonder/.gitconfig     user.email=xxxxxx
file:/Users/otaviobonder/.gitconfig     core.autocrlf=input
file:.git/config        core.repositoryformatversion=0
file:.git/config        core.filemode=true
file:.git/config        core.bare=false
file:.git/config        core.logallrefupdates=true
file:.git/config        core.ignorecase=true
file:.git/config        core.precomposeunicode=true
file:.git/config        remote.origin.url=https://github.com/otaviobps/TransferEasy_newFrontEnd.git
file:.git/config        remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
file:.git/config        branch.master.remote=origin
file:.git/config        branch.master.merge=refs/heads/master
Enter passphrase for key '/Users/otaviobonder/.ssh/id_rsa':

我只是隐瞒了我的电子邮件地址

编辑2:我使用的是zsh,我可以看到它在每个命令之后都会自动运行一个SSH命令,因为我看到终端窗口标题更改为SSH ,但我不知道为什么和哪个命令

编辑3:这是.zshrc的配置:

# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)


# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

### Added by Plugin's installer
source '/Users/otaviobonder/.zplugin/bin/zplugin.zsh'
autoload -Uz _zplugin
(( ${+_comps} )) && _comps[zplugin]=_zplugin
### End of Zplugin's installer chunk

zplugin light zdharma/fast-syntax-highlighting
zplugin light zsh-users/zsh-autosuggestions
zplugin light zsh-users/zsh-history-substring-search
zplugin light zsh-users/zsh-completions
zplugin light buonomo/yarn-completion

pasteinit() {
  OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
  zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
}

pastefinish() {
  zle -N self-insert $OLD_SELF_INSERT
}
zstyle :bracketed-paste-magic paste-init pasteinit
zstyle :bracketed-paste-magic paste-finish pastefinish


# Simplify prompt if we're using Hyper
if [[ "$TERM_PROGRAM" == "Hyper" ]]; then
  SPACESHIP_PROMPT_SEPARATE_LINE=false
  SPACESHIP_DIR_SHOW=false
  SPACESHIP_GIT_BRANCH_SHOW=false
fi
  # Set Spaceship ZSH as a prompt
  autoload -U promptinit; promptinit
  prompt spaceship

我尝试禁用git插件,但问题仍然存在

1 个答案:

答案 0 :(得分:0)

不应要求任何“ SSH”数据(密码/密码/...)

您正在使用HTTPS URL,因此请首先检查git config credential.helper的输出:您可能必须在此处重置缓存的凭据(在Mac的Windows Credentials ManagerOSX KeyChain中)。

  

我的github凭据已全局设置

确保您的意思不是user.name / user.email:这些不是GitHub凭据。


如果确实要求每个 命令输入密码,请选中“ How to fix: MacOS keep asking passphrase for ssh key after upgrade or reboots

$ vi ~/.ssh/config

Host *
  UseKeychain yes