Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hexo-deployer-git does not reference my ~/.ssh/config settings, OR it is not using my ssh user agent #368

Open
6 tasks done
MSoup opened this issue Jul 4, 2024 · 3 comments

Comments

@MSoup
Copy link

MSoup commented Jul 4, 2024

Check List

  • I have already read README.
  • I have already searched existing issues and they are not help to me.
  • I examined error or warning messages and it's difficult to solve.
  • I am using the latest version of this repository.
  • I am using the latest version of Hexo.
  • My Node.js is matched the required version.

Describe the bug

npx hexo deploy does not reference my ~/.ssh/config or it is not using my ssh user agent.

As a result, it hangs at the deploy step.

...
INFO  90 files generated in 743 ms
INFO  Deploying: git
INFO  Clearing .deploy_git folder...
INFO  Copying files from public folder...

It does not proceed from the above and I have to restart my computer in order to get my daemon back in a functioning state (colima).

Expected behavior

git authenticates via my ssh user agent, checks the ~/.ssh/config file to map personal.github.com to github.com before finally authenticating with the remote and pushing my static bundle

How to reproduce

  1. From within dev container, run npx hexo clean && npx hexo deploy

Screenshots

No response

Environment information

hexo: 7.2.0
hexo-cli: 4.3.2
os: linux 6.5.0-42-generic Debian GNU/Linux 12 (bookworm) 12 (bookworm)
node: 20.15.0
acorn: 8.11.3
ada: 2.7.8
ares: 1.28.1
base64: 0.5.2
brotli: 1.1.0
cjs_module_lexer: 1.2.2
cldr: 45.0
icu: 75.1
llhttp: 8.1.2
modules: 115
napi: 9
nghttp2: 1.61.0
nghttp3: 0.7.0
ngtcp2: 1.1.0
openssl: 3.0.13+quic
simdutf: 5.2.8
tz: 2024a
undici: 6.13.0
unicode: 15.1
uv: 1.46.0
uvwasi: 0.0.21
v8: 11.3.244.8-node.23
zlib: 1.3.0.1-motley-7d77fb7

Additional context

I have tested from within my dev container that ssh user agent forwarding is working as expected, and regular git commands work as well.

From within my dev container

root@cc7327dbf799:/app# ssh-add -l
256 SHA256:/pARioj... (ED25519)

root@cc7327dbf799:/app# git pull
remote: Enumerating objects: 49, done.
remote: Counting objects: 100% (49/49), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 32 (delta 14), reused 30 (delta 12), pack-reused 0
Unpacking objects: 100% (32/32), 9.27 KiB | 50.00 KiB/s, done.

My remote URL looks like

root@cc7327dbf799:/app# git remote -v
origin  git@personal.github.com:<user>/<repo>.git (fetch)
origin  git@personal.github.com:<user>/<repo>.git (push)

And my ~/.ssh/config looks like

Host personal.github.com
  HostName github.com

I don't know how to further inspect what is happening. I know that with git I can do something like GIT_TRACE=true git pull, but I cannot do the same for this tool in order to further debug.

@uiolee
Copy link
Member

uiolee commented Jul 8, 2024

log.info('Copying files from public folder...');
if (typeof ignoreHidden === 'object') {
opts.ignoreHidden = ignoreHidden.public;
} else {
opts.ignoreHidden = ignoreHidden;
}
if (typeof ignorePattern === 'string') {
opts.ignorePattern = new RegExp(ignorePattern);
} else if (typeof ignorePattern === 'object' && Reflect.apply(Object.prototype.hasOwnProperty, ignorePattern, ['public'])) {
opts.ignorePattern = new RegExp(ignorePattern.public);
}
return fs.copyDir(publicDir, deployDir, opts);
}).then(() => {
log.info('Copying files from extend dirs...');

Judging from the logs you provided, it's stuck at the step of copying files, which has nothing to do with ssh.

Or maybe you haven't provide complete logs.

@MSoup
Copy link
Author

MSoup commented Jul 8, 2024

Thank you for the observations. I decided to try the same steps without the dev container to focus on the topic of git/ssh and not possible permissions issues within the dev container.

Observations

Now the public folder is deployed, but as the deployer doesn't reference my ~/.ssh/config file, it is using the wrong private key to deploy to the gh pages branch. (it shows my other account as the account that pushed to the gh-pages branch)

Temp Fix

The only temporary fix I know right now is forcing the deploy script to use a different "GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL, like

"deploy": "GIT_AUTHOR_NAME='Foo' GIT_AUTHOR_EMAIL='foo@example.com' hexo deploy",

I have also tried setting name and email from within _config.yml but the deployer doesn't seem to pick them up either.

Is there anything I can do to produce more helpful logs?

@uiolee
Copy link
Member

uiolee commented Oct 7, 2024

deployer doesn't reference my ~/.ssh/config file

deployer just simply exec git commit git push and so on. It's possible that you haven't configured ssh or git correctly.


I have also tried setting name and email from within _config.yml but the deployer doesn't seem to pick them up either.

#353 has solved this issue but has not been published to npmjs yet.

you can try:

npm i https://github.com/hexojs/hexo-deployer-git/tree/880a3c3332d82743521f86737b7d815b128e622b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants