0 votes
1 view
in Devops and Agile by (28.1k points)

I git push my work to a remote Git repository.

Every push will prompt me to input username and password. I would like to avoid it for every push, but how to configure to avoid it?

1 Answer

0 votes
by (48k points)

For avoiding the specification of the username and password at every git push

You need to do the following steps:

1. Generate an SSH key

2. Associate the SSH key with the remote repository

3. Set your remote URL to a form that supports SSH 1

Generate an SSH key

In Linux/Mac

Open terminal to create ssh keys:

cd ~                 #Your home directory

ssh-keygen -t rsa    #press enter for all value

For Windows

Use Putty-Gen to generate a key

Export the key as an open SSH key

Associate the SSH key with the remote repository

If it is a GitHub repository and you have administrative privileges, go to settings and click 'add SSH key'. Copy the contents of your ~/.ssh/id_rsa.pub into the field labeled 'Key'.

If your repository is administered by somebody else, give the administrator your id_rsa.pub.

If your remote repository is administered by you, then you can use this command for example:

scp ~/.ssh/id_rsa.pub [email protected]_IP:~/.ssh/authorized_keys/id_rsa.pub

Set your remote URL to a form that supports SSH 1

If you have done the steps above and are still getting the password prompt, make sure your repo URL is in the form

git+ssh://[email protected]/username/reponame.git

And change it to


To see your repo URL, run:

git remote show origin

You can change the URL with:

git remote set-url origin git+ssh://[email protected]/username/reponame.git

Thus, you can ssh without a password at every git push.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !