提示输入密码但不输入用户名? [英] Prompt for password but not username?

查看:104
本文介绍了提示输入密码但不输入用户名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以让git仅提示输入密码,并自动确定用户名?我想要额外增加一层人工干预作为提醒,以便小心我所推送的内容,但只需输入密码,而不是每次都输入用户名即可。

Is it possible to get git to prompt only for a password, and determine your username automatically? I want to have the extra layer of manual intervention as a reminder to be careful what I push, but just entering a password and not also the username every time is sufficient.

推荐答案

如果您使用的是https url,则可以更改上述url,以便在git repos托管服务器之前包含您的用户名(例如, github.com ):

If you are using https url, you can change said url in order to include your username just before the git repos hosting server (here, for instance, github.com):

git remote set-url origin https://<yourUsername>@github.com/<yourUsername>/<yourRepo>
                           ^^^^^^^^^^^^^^

每次你将 git push ,它只会询问您的密码。

Each time you will git push, it will ask only for your password.

这篇关于提示输入密码但不输入用户名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆