1

I am using a git repo over ssh but the ssh server is only configured for username / password authentication there is no way for me to configure authentication with this server using certificates.

So when I do a clone operation such as ssh://user@host/git/demo.git git asks me for a password to clone the repo.

I want to avoid having to type the password so I tried executing the following command based on another StackOverflow question on how to avoid having to type the password with https

git config --global credential.helper "cache --timeout=86400"

However the password I type is not getting cached.

I have to merge 20 different git repos into one big git repo and I want to write a shell script to do this so I don't want to have to keep typing my password.

Is there a way to pass the password to git from within a bash shell script? I am using git 1.8.5.1 on CentOS 6.5

7
  • 2
    Can you just use standard SSH key authentication? Commented Dec 5, 2013 at 21:52
  • You might be interested in en.wikipedia.org/wiki/Expect and pexpect.sourceforge.net/pexpect.html Commented Dec 5, 2013 at 21:52
  • there is no way for me to configure authentication with this server using certificates. If this is also specifically referring to key auth, then (based on my experience with sshd) I believe you're out of luck, since it requires some sort of authentication on every connection. Commented Dec 5, 2013 at 21:55
  • see Generating Your SSH Public Key Commented Dec 5, 2013 at 21:56
  • Where is the git server hosted? Could you have git repos served over http? (for example, github allows for cloning repos via http) Commented Dec 5, 2013 at 21:59

1 Answer 1

1

One possible way to do this is to use a git client made for programmatic access. I've never used it before, but something like https://github.com/gordonwritescode/Nougit could do it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.