Home > Uncategorized > Git push requires username and password

Git push requires username and password

Problem
You want to push a new project to github, but it asks for your username and password each time.

Solution
I found the solution here. Here I copy Davide‘s answer (reformulated a bit):

First, check the remote repository:

git remote -v

which will respond something like

origin  https://yourname@github.com/yourname/yourrepo.git (fetch)
origin  https://yourname@github.com/yourname/yourrepo.git (push)

Execute the following command:

git remote set-url origin git@github.com:yourname/yourrepo.git

Notice that you need to do some transformations: “https://yourname@” is replaced with “git@“, and “/yourname” becomes “:yourname“.

Now “git push” should work fine.

Advertisements
Categories: Uncategorized Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: