Giter Club home page Giter Club logo

ssh-agent-cmd's Introduction

ssh-agent script for Windows CMD.exe

You hate entering your password over and over and over when you're using git in the Windows cmd.exe Command Processor, right?

Me too. So, here's a script that will launch ssh-agent, or connect to an existing one. There's also a registry entry key that you can import, that will cause it to run the script automatically in every command processor you open.

You probably DO NOT need to use the auto-start registry hack. If you place this script in your startup folder, it should successfully write the variables to your global registry, therefore allowing any further command shells that are spawned to know how to use the ssh-agent.

**** WARNINGS ****

IF YOU USE THE REGISTRY HACK TO AUTO-START THIS SCRIPT, YOU MUST EDIT THESE FILES AND PLACE THE CORRECT LOCATIONS TO YOUR FILES, OTHERWISE BAD THINGS MAY HAPPEN.

**** Installation ****

Place sshagent.cmd somewhere within your system. Edit it to change the SSH_BIN_PATH variable.

If you want to use the registry entry, edit the autorun.reg file, and change the path listed in "AutoRun"="d:\\sshagent.cmd" to point to the location where your sshagent.cmd you will be using is. Then double-click the autorun.reg file. (Make sure you use double slashes in this file! If you screw up this file, I don't know what will happen. Maybe nothing, maybe you won't be able to start a command window again without undoing it)

If you have git 1.7.0 for windows or better, and you are constantly nagged by github to enter credentials for https accesses, you might try:

git config --global credential.helper wincred

**** Caveats ****

Nothing that I know of!

**** License ****

This is free. Plain-old free, public domain. As open as it gets. Do whatever you want with it. It'd be super nice, though, if you were to make any changes that someone else would find useful, if you contributed those as a pull request. Open source works best when everyone helps!

And don't forget: Today, you should BE AWESOME.

ssh-agent-cmd's People

Contributors

asadeghi avatar bambams avatar ericblade avatar raeesbhatti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ssh-agent-cmd's Issues

if something opens an invisible command window at startup, this script fails every time

... I have something installed very early in my boot process, I don't know what, because it's not showing up with any failures, that is apparently launching an invisible command process. Immediately upon booting, my taskmgr has a showing ssh-agent, ssh-add, and cmd.exe.

Because it's sitting there presumably waiting for a password, on a terminal window that isn't visible, all future invocations of the script fail, because they see the ssh-agent already running, and therefore don't run the ssh-add.

There's two things that need to be achieved to fix this problem --

1- Somehow detect that we're not in a real window, or that we have no possible stdin, and don't run ssh-add
2- Detect any ssh id files that haven't been added, using ssh-add -l to list the items already added, and only try to add ids that aren't already there.

I have fixed the problem

I just created https://github.com/raeesbhatti/ssh-agent-helper, a pain-free way to deal with SSH Agent problem in Windows. It starts the SSH Agent and sets the SSH_AUTH_SOCK and SSH_AGENT_PID as user's environment variables. Which means that ssh.exe, ssh-agent.exe or any other program that consumes SSH Agent can connect to it without any configuration.
Which means that you don't even need startup scripts to make ssh-add or ssh work in CMD and PowerShell. It just works ๐Ÿ˜„

Does not appear to work in Windows 10 Anniversary Update

> c:\sshagent.cmd Looking for existing ssh-agent... Finished looking... Starting agent File not found - C:\Users\Eric\AppData\Local\Temp\ssh-agent-socket.tmp Could Not Find C:\Users\Eric\AppData\Local\Temp\ssh-agent-socket.tmp The system cannot find the path specified. The system cannot find the path specified. The system cannot find the path specified.

then it loops like that forever.
ugh!

I could kiss you

This is exactly what I was looking for since the last two years. It has given me so much joy that I could not possibly express in this comment.
Thanks you โค๏ธ ๐Ÿ˜

Agent Found: Still asking for passphrase

Hello,
I followed your tutorial meticulously, I first launch Git Bash, enter my passphrase then switch to cmd (An agent is found successfully)

However, when I try to to SSH to my server, I still get asked for my passphrase

Where might have I gone wrong?
Please forgive this question that might seem idiotic. I'm still new to the whole SSH thing and it's still rather confusing.

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.