0


Git切换账号提交代码

1、添加账号

git config --global user.name “dingdayong”
git config --global user.email “dingdayong@china.cn

2、切换账号

git config user.name “dingdayong”
git config user.email “dingdayong@china.cn

3、查看账号

git config user.name
git config user.email

4、提交代码

git add .
git commit -m “%210 fix(core) : 接口开发”
git push

5、使用SSH密钥

如果你使用SSH密钥来连接Git仓库,需要在切换账号时更新SSH密钥。

使用以下命令生成新的SSH密钥:ssh-keygen -t rsa -b 4096 -C “dingdayong@china.cn
在这里插入图片描述
然后将新的SSH公钥添加到你的Git账号中:
在这里插入图片描述

或者

登录到你的GitLab账号。
点击右上角的用户头像,选择"Settings"。
在左侧导航菜单中,选择 “SSH Keys”(SSH密钥)。
在 “Key” 字段中,粘贴上一步生成的公钥内容(可以为该密钥添加一个可识别的标题,以便于识别该密钥)
点击 “Add key”(添加密钥)保存并添加公钥。

6、使用https密码

对于新机器,使用https密码连接Git时,需要输入该密码 ?
nHpmvd+VIRv5NAa******dUbLIHrQrG6a9fwd5Kw

标签: git

本文转载自: https://blog.csdn.net/Pluto_CSND/article/details/143233587
版权归原作者 Pluto_CSND 所有, 如有侵权,请联系我们删除。

“Git切换账号提交代码”的评论:

还没有评论