0

I'm using Git to clone my repository from Github. I'm using HTTPS to clone it.

Everytime I cd to the repository, or every command I do, the terminal asks me my SSH key password. This is strange, since I'm not using SSH to connect to Github.

If I type my SSH key password, the terminal hangs. If I just ignore it (pressing return), everything works fine, however it keeps asking my SSH password every new command.

I don't have a clue what can it be, and I'm having this problem with two repositories that contains javascript code.

Thanks in advance

Edit: git config --show-origin -l returns this:

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':

I just suppressed my email address

Edit 2: I'm using zsh, and I can see that after every command, it runs a SSH command automatically, because I see the terminal window title changes to SSH, but I don't know why and which command

Edit 3: Here is the .zshrc configuration:

# 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

I tried to disable the git plugin, but the issue persists

Otavio Bonder
  • 1,015
  • 1
  • 7
  • 19

1 Answers1

0

It should not be asking for any "SSH" data (password/passphrase/...)

You are using an HTTPS URL, so check first the output of git config credential.helper: you might have to reset cached credentials there (in the Windows Credentials Manager or OSX KeyChain for Mac).

My github credentials are set globally

Make sure you don't mean user.name/user.email: those are not GitHub credentials.


If it does ask for the passphrase on every command, check "How to fix: MacOS keep asking passphrase for ssh key after upgrade or reboots"

$ vi ~/.ssh/config

Host *
  UseKeychain yes
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • `cd TransferEasy_newBackEnd` `Enter passphrase for key '/Users/otaviobonder/.ssh/id_rsa':` It's asking for SSH key password, not Github password. My github credentials (username and password) are set globally. I never need to type them. This is just happening with two repositories, so I guess it's not a problem with credentials. I already deleted and cloned it again, but this won't fix the issue – Otavio Bonder Jun 23 '19 at 14:26
  • @OtavioBonder Interesting: you could add that to your question. – VonC Jun 23 '19 at 14:26
  • @OtavioBonder "My github credentials (username and password) are set globally.": what does that mean? *How* are they set globally? – VonC Jun 23 '19 at 14:27
  • they are cached – Otavio Bonder Jun 23 '19 at 14:28
  • @OtavioBonder in the OSX KeyChain? What OS are you using? What version of Git are you using? – VonC Jun 23 '19 at 14:28
  • Yes, in OSX KeyChain. Git version 2.21.0. OSX 10.14.5 – Otavio Bonder Jun 23 '19 at 14:30
  • @OtavioBonder Would the link I mention in my edited answer be helpful in your case? – VonC Jun 23 '19 at 14:37
  • Unfortunatelly no. It just starts asking the SSH password when I enter in the repository directory. And it shouldn't ask, because it's not configured to use SSH, and even if I type the password, the terminal hangs. It just works without using the SSH key – Otavio Bonder Jun 23 '19 at 14:41
  • @OtavioBonder Did you modify the ~/.ssh/config (as mentioned in the answer)? – VonC Jun 23 '19 at 14:42
  • No. My SSH key works fine to login to my remote servers. I really have no idea why it's asking the SSH key for this repo. I think it's some configuration in the repo, but I don't know which one – Otavio Bonder Jun 23 '19 at 14:44
  • @OtavioBonder OK, can you edit your question with `git config --show-origin -l`, as done from within your local repository? – VonC Jun 23 '19 at 14:46
  • @OtavioBonder Maybe the content of `~/.zshenv` or `~/.zshrc` is relevant here. – VonC Jun 23 '19 at 15:18
  • @OtavioBonder Any zsh plugin (https://github.com/unixorn/awesome-zsh-plugins) installed? (like https://github.com/jeffwalter/zsh-plugin-cd-ssh) – VonC Jun 23 '19 at 15:24