Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pull from github without authentication every time

Is there a way to generate a certificate or such so that my prod server can pull from my github repo without me authenticating every single time?

like image 668
Matt Welander Avatar asked Oct 31 '13 08:10

Matt Welander


People also ask

How do I stop Git from asking for credentials?

You can avoid being prompted for your password by configuring Git to cache your credentials for you. Once you've configured credential caching, Git automatically uses your cached personal access token when you pull or push a repository using HTTPS.

Why is Git asking for username and password every time?

If Git is always asking you for your username and password when pushing or pulling your code from a GitHub repository, This is a common problem if you use HTTPS clone URL for cloning the repository. Let's see how to solve this! The https:// clone URLs are available on all public and private repositories.

How do I stop Git push from asking for username and password?

Issue the command git fetch/push/pull. You will not then be prompted for the password.


1 Answers

You can create an access token and use it as username (without password).

Once you have your access token clone the repository:

git clone https://<your-access-token>@github.com/username/repo.git

Then you can pull without authenticating every single time.

This is the simplest method but will store the token plain text into .git/config To improve security you can setup password caching and clone as usual https:

git clone https://github.com/username/repo.git

If you want remove access of server to repository, just delete the access token in your application settings.

I also prefer to use https than ssh on deploy environments. Some times we don't have enough access privileges to handle with ssh, but https access to github is available even on cheaper hosting services.

like image 142
EHER Avatar answered Oct 04 '22 19:10

EHER