美文网首页
【操作】Git版本控制#3 SSH公钥

【操作】Git版本控制#3 SSH公钥

作者: needrunning | 来源:发表于2020-02-06 11:08 被阅读0次

SSH 实际上是一种认证协议,是服务器间通讯,相互信任的一种协议

ssh-keygen -t rsa -C "xxxxx@xxxxx.com" 

添加 SSH 公钥

参考 生成/添加SSH公钥

image.png

-bash: git: command not found

 yum install -y [git](https://www.bxl.me/b/git/)

The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.

28760#28760: *1 client closed connection while waiting for request, client: 117.100.6.163, server: 0.0.0.0:80

Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'root@10-9-77-82.(none)')

查看项目 Git 信息

项目文件夹下执行

ls -al

会有一个.git 文件夹,记录项目git相关的所有信息,git 网页界面上显示的用户名信息/ git 提交触发邮件推送内容中的开发者信息都是通过本地全局git信息读取的。

cd .git
cat config

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "origin"]
    url = 远程仓库地址
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[user]
    name = 代码提交者用户名
    email = 代码提交者邮箱

查看修改仓库的用户名和邮箱

git config user.name:查看用户名
git config user.email:查看邮箱
git config user.name "你的用户名":修改你本地一个仓库的用户名
git config user.email"你的邮箱":修改你本地一个仓库的邮箱

git config --global user.name"你的用户名":修改全局仓库的用户名
git config --global user.email"你的邮箱":修改全局仓库的邮箱

另外

git remote -v· 可以查看该项目对应远端哪个仓库(包括fetch或者push

Please tell me who you are.

如果 .git 文件夹下config文件不包含user节点,就会出现检测不到提交者信息的情况,这时通过git config 设置即可。

相关文章

网友评论

      本文标题:【操作】Git版本控制#3 SSH公钥

      本文链接:https://www.haomeiwen.com/subject/frlhectx.html