Avoid Entering Git Credentials for Every Push/Pull by Embedding Them in the Repo URL

It’s possible to embed credentials in the Git repo URL. If a URL with embedded credentials is used to clone a repo, Git won’t prompt for credentials on any subsequent push/pull operations on this repo.

A repo URL with embedded credentials looks like this:


Use it when you clone the repo & you never have to enter the credentials again.

But there’s a catch! The credentials must be URL encoded.

Consider the following Git credentials that AWS IAM generated for my IAM user:


They contain special characters which aren’t valid for a URL. They must be URL encoded before embedding them. The quickest way to URL encode a string is to run the encodeURIComponent() JS function in Chrome console:

The encoded credentials can now be embedded in a repo URL:


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.