First, you need to make sure if you are indeed using ssh on GCP in your repository folder:
cd /path/to/repository
git remote -v
# Check the URL is
# git@github.com:you/yourRepository
# ^^^ (note the :)
# Or:
# ssh://git@github.com/you/yourRepository
# ^^^ (note the /)
Check also your environment variables:
env|grep -i SSH
(A GIT_SSH...
environment variable might affect how Git operates with SSH)
And see if the network route is still opened from your GCP shell to GitHub:
curl -v telnet://github.com:22
# You should see
Connected to github.com (140.82.121.3) port 22 (#0)
For testing, check if you can use (while entering your GitHub account and a GitHub Personal Acccess Token or PAT) use HTTPS:
git ls-remote https://github.com/You/yourRepository
If you are using SSH, activate traces on SSH ,and on Git itself with TRACE2
:
export GIT_SSH_COMMAND='ssh -Tv'
GIT_TRACE2_EVENT=1 git pull
# or
GIT_TRACE2=1 git pull
As noted in the OP Louis Hong's answer, activating the traces would show the step where, by tring to add a key to an ssh-agent
(from the ~/.ssh/config
), said ssh-agent might request a passphrase for another (encrypted) key, thereby hanging on stdin.