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.

Poka Yoke
  • 333
  • 2
  • 8
  • 25

2 Answers2

1

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.

Steven Penny
  • 82,115
  • 47
  • 308
  • 348
  • 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. – Poka Yoke Oct 01 '15 at 07:01
  • 1
    @PokaYoke yes it does work. I have 8 HTTPS repos and I use this method – Steven Penny Oct 01 '15 at 14:00
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:password@mygithost.com/my/repository
Maximillian Laumeister
  • 18,162
  • 7
  • 50
  • 70