Upgrade Script Git save username and password


(Nic Hubbard) #1

Is it possible to enter my git username and password into a config somewhere so I don't have to enter it so many times? I think during this upgrade I have entered it 20 times...


(Bart Banda) #2

I believe you can enter your username and password as part of the Git URL to use the HTTP authentication, in the main.conf:

            'git'           => Array(
                               'location' => 'https://username:password@github.com/squizlabs/Matrix.git'
                              ),

(Nic Hubbard) #3

Thanks!


(Benjamin Pearson) #4

You cannot use ssh?


(Nic Hubbard) #5

I am talking about when running the upgrade scripts. It will prompt you for your git username and password when it is checking out the various versions.


(Benjamin Pearson) #6

yeah, I mean can't you use the git@github.com url instead of the https url? or is there some restriction I am missing?


(Benjamin Pearson) #7

alternatively, if you have using git 1.7.9 or higher, you should be able to use:

git config --global credential.helper osxkeychain|gnome-keyring

Depending on the OS you use, OSX use osxkeychain and Linux use gnome-keyring... should be much safer than leaving a password in a file ;)


(Marcus Fong) #8

Another alternate method is to “git clone” a local copy of the repository, then point “location” in the upgrade script’s main.conf to it.

We tend to do that when upgrading systems where we may not have external access to git - in those cases, it’s much easier and better than the old “pre_uploaded” method was.


(Nic Hubbard) #9

yeah, I mean can't you use the git@github.com url instead of the https url? or is there some restriction I am missing?

 

I have no idea. That is why I am asking you guys. :)


(Benjamin Pearson) #10

I think you should be able to:

Add your public key to your profile under gitlab (Edit profile -> Add SSH keys), uncomment the git path (and change if needed) in main.conf and try changing the url from https://gitlab.squiz.net/Labs/Matrix.gitto git@gitlab.squiz.net:Labs/Matrix.git

 

If that doesn't work, then maybe there is some other restriction in place to stop that.


(Nic Hubbard) #11

None of these solutions ever seemed to help. Doing an upgrade again and having to enter my credentials 50 times sucks.


(Marcus Fong) #12

Just curious, Nic - did you try taking a repo clone and repointing “location” in main.conf to it? That always worked well for me when I was in a situation where git access was problematic.


(Nic Hubbard) #13

I have used git a lot, but I have actually not sure what you mean. :frowning:


(Marcus Fong) #14

First “git clone” the Matrix repo.

Then edit the automatic upgrade script’s main.conf file and change “location” to point to the location of your local git clone.

Then just run the upgrade script normally - it’ll pull everything from your local clone instead of connecting to the remote Git server.

We use that method when upgrading on clients’ networks where no connection to Git is available.


(Nic Hubbard) #15

Got it. Thanks for the great and simple idea!