Why is Github asking for username/password when following the instructions on screen and pushing a new repo?

I’m the owner of an organization on github and just created a repo and tried pushing but I’m running into an issue where it’s asking me for my username even though I can SSH just fine:

$ ssh -T git@github.com
Hi Celc! You've successfully authenticated, but GitHub does not provide shell access.
$ git add .
$ git commit -m 'first commit'
[master (root-commit) 3f1b963] first commit
 6 files changed, 59 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 main.js
 create mode 100644 package.json
 create mode 100644 readme.markdown
 create mode 100644 views/index.ejs
 create mode 100644 views/layout.ejs
$ git remote add origin https://github.com/WEMP/project-slideshow.git
$ git push -u origin master
Username for 'https://github.com':

What am I doing wrong? This has never happened to me before but I recently also upgraded to git 1.7.10.3.

  • How do I completely delete user info from git terminal?
  • unable to get SSH keys working between sourcetree and github
  • How do show my tests passing/failing in Github?
  • “gerrit: replicate: not found” even after installing replication plugin
  • Abandoning Git commits on Github for rejected pull requests
  • How to add git hook to the remote repository?
  • Git Commit or Git Stash error
  • How to trigger git hooks without pushing to the repo
  • 9 Solutions collect form web for “Why is Github asking for username/password when following the instructions on screen and pushing a new repo?”

    Don’t use HTTP use SSH instead

    change

    https://github.com/WEMP/project-slideshow.git 
    

    to

    git@github.com:WEMP/project-slideshow.git
    

    you can do it in .git/config file

    I had this same issue and wondered why it didn’t happen with a bitbucket repo that was cloned with https. Looking into it a bit I found that the config for the BB repo had a URL that included my username. So I manually edited the config for my GH repo like so and voila, no more username prompt. I’m on Windows.

    Edit your_repo_dir/.git/config (remember: .git folder is hidden)

    Change:

    https://github.com/WEMP/project-slideshow.git
    

    to:

    https://*username*@github.com/WEMP/project-slideshow.git
    

    Save the file. Do a git pull to test it.

    The proper way to do this is probably by using git bash commands to edit the setting, but editing the file directly didn’t seem to be a problem.

    Here is an official answer to this:

    If Git prompts you for a username and password every time you try to interact with GitHub, you’re probably using the HTTPS clone URL for your repository.

    Using an HTTPS remote URL has some advantages: it’s easier to set up than SSH, and usually works through strict firewalls and proxies. However, it also prompts you to enter your GitHub credentials every time you pull or push a repository.

    You can configure Git to store your password for you. If you’d like to set that up, read all about setting up password caching.

    an additional note:

    if you have already added a remote ($git remote add origin … ) and need to change that particular remote then do a remote remove first ($ git remote rm origin), before re-adding the new and improved repo URL (where “origin” was the name for the remote repo).

    so to use the original example :

    $ git remote add origin https://github.com/WEMP/project-slideshow.git
    $ git remote rm origin
    $ git remote add origin https://github-username@github.com/WEMP/project-slideshow.git
    

    I’ve just had an email from a github.com admin stating the following: “We normally advise people to use the HTTPS URL unless they have a specific reason to be using the SSH protocol. HTTPS is secure and easier to set up, so we default to that when a new repository is created.”

    The password prompt does indeed accept the normal github.com login details. A tutorial on how to set up password caching can be found at https://help.github.com/articles/set-up-git#password-caching . I followed the steps in the tutorial, and it worked for me.

    Because you are using HTTPS way.HTTPS requires that you type your account access every time you try to push or pull,but there is one way too, called SSH, and it lets you to tell git, that I give you permission with my account for this pc, and never ask me again about any user access. To use it, you have to generate SSH key and add it into your Github’s account just one time.To do that, you can follow these steps

    How To Generate SSH key for Github

    Improving upon @Ianl’s answer,

    If you want to disable the prompts for both the username and password then you can set the URL as follows –

    git remote set-url origin https://username:password@github.com/WEMP/project-slideshow.git
    

    Note that the URL has both the username and password. Also the .git/config file should show your current settings.

    If you’re using HTTPS, check to make sure that your URL is correct. For example:

    $ git clone https://github.com/wellle/targets.git
    Cloning into 'targets'...
    Username for 'https://github.com': ^C
    
    $ git clone https://github.com/wellle/targets.vim.git
    Cloning into 'targets.vim'...
    remote: Counting objects: 2182, done.
    remote: Total 2182 (delta 0), reused 0 (delta 0), pack-reused 2182
    Receiving objects: 100% (2182/2182), 595.77 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (1044/1044), done.
    

    If you’ve enabled two factor authentication, then you’ll need to generate a personal access token and use that instead of your regular password. More info here: https://help.github.com/articles/creating-an-access-token-for-command-line-use/

    Git Baby is a git and github fan, let's start git clone.