Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

How to let systemd user unit see keys in SSH agent?

+0
−0

I have a script that does git fetch for a repository. When I run this in my shell it works fine.

I want to run it in a systemd user unit. However, I am using an SSH url, and the systemd unit fails with fatal: Could not read from remote repository.' (Git exit code 128).

This is probably because systemd doesn't have access to my SSH key and/or cannot handle the interactive passphrase prompt.

I've seen solutions like creating a passwordless SSH key, but I don't want to do that. I also don't want to explicitly point it to the key, because this will be on several machines that have differently named keys. I'd rather make the systemd unit get the SSH key the same way git fetch does for me: From the SSH agent. How can I do that?

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

Probably not a supported use case (2 comments)

0 answers

Sign up to answer this question »