0

I would like to store Git credentials for git pulls permenantly on a linux machine, and git credential.helper doesn't work ( I think because I'm not using SSH ) - I get that error "Fatal: could not read password for 'http://....': No such device or address". Given that I'm not the administrator of the repository and only HTTP is allowed for authentication, and fortunately I don't care about the safety of the password. What can I do to put the git pull command in a bash file and avoid prompting the user for password?

I hope there is a way around it.

2 Answers 2

3

Two things wrong with this question:

  1. Most repositories such as GitHub require HTTPS. Even if you try to clone over HTTP, it just switches it on the backend to HTTPS and pushes require it as well.

  2. Pulls don’t require a password, unless it’s a private repo. Like #1, since you’ve given no info about your repo it’s hard to comment further on this.

Now, what I do is this:

git config --global credential.helper store

Then the first time you push it will ask for your credentials. Once you’ve entered them they are stored in ~/.git-credentials. Note that they are stored in plain text, you have been advised.

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

2 Comments

Yes it is a private repo. And storing using credential.helper doesn't work because my repo is based on HTTPS not SSH. And since I can't enable SSH on the repository I have to deal with what I have.
@PokaYoke yes it does work. I have 8 HTTPS repos and I use this method
0

I'm assuming that your repository requires authentication for pulls, or else git wouldn't ask you for a password for the pull.

The recommended way to bypass the user password prompt is to create an SSH key on that machine, add the public key to the git server, then use the SSH url for the remote instead of the HTTP/S url. But since you specifically said:

I don't care about the safety of the password

you can actually just specify the password inline for the git pull like this:

git pull http://username:[email protected]/my/repository

1 Comment

Thanks, yes it's a private repo; so it needs a password to pull.

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.