简体   繁体   English

如何在Windows上更改git bash的用户名和主机名?

[英]How to change username and hostname for git bash on Windows?

How can I change the username and hostname in git bash? 如何在git bash中更改用户名和主机名?

在此输入图像描述

To set up user name in git: 要在git中设置用户名:

# set the user name as global (user level) configuration
git config --global user.name "user name"

To change the bash prompt read those answers: 要更改bash提示,请阅读以下答案:

Where exactly Git Bash for Windows' prompt is defined? 究竟是哪里定义了Git Bash for Windows'提示符?
Alter Git prompt on Windows 在Windows上更改Git提示

The basic issue is the you will have to create user profile file like you do in Unix. 基本问题是您必须像在Unix中一样创建用户配置文件。 In widows it will be placed under %PROGRAMFILES%\\Git\\etc\\profile and you will set the PS1 environment variable there. 在寡妇中,它将被置于%PROGRAMFILES%\\Git\\etc\\profile ,您将在那里设置PS1环境变量。

you have thre posibilities: 你有可能性:

  1. Systemwide change of that properties: 系统范围内的属性更改:

    git config --system user.name "user5148540" git config --system user.name“user5148540”

  2. changes on Windows user level Windows用户级别的更改

    git config --global user.name "user5148540" git config --global user.name“user5148540”

  3. Repository (Projekt Level) Level: for just a Projekt: 存储库(Projekt级别)级别:仅用于Projekt:

    git config user.name "user5148540" git config user.name“user5148540”

  1. For hostname, Change your computer name from system properties of PC 对于主机名,请从PC的系统属性更改您的计算机名称
  2. For username change your account name( from which you log in) 对于用户名,请更改您的帐户名称(从中登录)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM