8

Since I have the new version it doesnt ask me anymore for the password I set in my ssh key file.

It asks now directly for a github username and password when I push every time.

Is this a new feature of git or changed it in the past or is there something which changed on github?

I tried to authenticate using ssh and the email and password from my ssh key file and it worked.

GitHub changed to smartftp and also changed the instructions for setting up repos

https://github.com/blog/1104-credential-caching-for-wrist-friendly-git-usage

https://help.github.com/articles/create-a-repo

Saw it later, they use now https instead of the git protocol by default

  • Check if your remote is really configured for `git` or `ssh` access by running `git remote -v`. It is possible you cloned from `https` by accident. Otherwise this shouldn't be required. – pmr Jun 09 '12 at 15:32
  • I see that github changed the documentations for setting up repos, see step 3: https://help.github.com/articles/create-a-repo they use https before this it was git@github.com only ... –  Jun 09 '12 at 15:37

3 Answers3

4

I ran into this the other day when cutting-and-pasting from the new repository instructions on GitHub. Someone should probably file a bug report, because it confuses almost everyone I know.

The issue is that the instructions tell you to create a remote that uses the https protocol, rather than the git protocol. I typically use:

github_username=CodeGnome
git remote add origin "git@github.com:${github_username}/${PWD##*/}.git"
git push --tags --set-upstream origin master

to populate a new GitHub repository from a pre-existing local one.

Todd A. Jacobs
  • 81,402
  • 15
  • 141
  • 199
  • https://github.com/blog/1104-credential-caching-for-wrist-friendly-git-usage seems they wrote a blog post about it but did not mention to replace the instructions –  Jun 09 '12 at 15:46
  • so currently we have to type in username and password every time (github thinks smart http is the future so should we use it?)? but the advantage is, that we can set every time the username we want currently so we dont push from the wrong github account =) –  Jun 09 '12 at 15:57
  • 2
    @DanielRuf If you use Smart HTTP, you can use credential caching on Windows and OS X. See http://stackoverflow.com/a/10962447/1301972. – Todd A. Jacobs Jun 09 '12 at 16:04
2
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=3600'

you only input your username and password when you push first;after 3600s or 1 hour ,you push without username and password .

timeout you could set your number.

1

With https addresses, you have another option (beside the password caching):
Using an _netrc file, which will contain your username and password, in your HOME (or a .netrc for bash session).
Note that HOME isn't defined by default for Windows.

machine github.com
login <login_github>
password <password_github>

See also "Git - How to use .netrc file on windows to save user and password".

(Other options at "Syncing with github")

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    I kinda like that, but plain text files with passwords doesn't seem particularly secure. This whole thing seems backwards somehow. – Thufir Jun 11 '12 at 12:03
  • 1
    @Thufir in my shop, we mitigate the "plain text" issue by keeping our `%HOME%` defined on a remote disk (like "`Z:\`" for instance), putting our `_netrc` file there. And you can still encrypt it if you want: http://stackoverflow.com/questions/5193643/netrc-netrc-alternative-to-curl/5193917#5193917 – VonC Jun 11 '12 at 12:06