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: