Git (1.7.10) asks me every time for username and password

和自甴很熟 提交于 2019-11-30 13:39:13

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.

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.

VonC

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")

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!