下载安装git、配置git和生成 ssh-key
charlie@charlie-virtual-machine:~/work/test$ git clone git@github.com:charlie-xxxxxx/uboot.git
Cloning into 'uboot'...
The authenticity of host 'github.com (192.30.255.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
charlie@charlie-virtual-machine:~/work/test$
进入 ubuntu 系统,输入下面的命令安装git:
sudo apt-get install git
使用git config命令配置自己的账号 邮箱,这样提交代码的时候就知道是谁提交的了
charlie@charlie-virtual-machine:~/work/test$ git config --global user.name "charlie"
charlie@charlie-virtual-machine:~/work/test$ git config --global user.email "515xxxxxx1@qq.com"
charlie@charlie-virtual-machine:~/work/test$
charlie@charlie-virtual-machine:~/work/test$ git config --global user.name
charlie
charlie@charlie-virtual-machine:~/work/test$ git config --global user.email
515287251@qq.com
charlie@charlie-virtual-machine:~/work/test$
charlie@charlie-virtual-machine:~/work/test$ ssh-keygen -t rsa -C "51528xxxxxx1@qq.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/charlie/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/charlie/.ssh/id_rsa.
Your public key has been saved in /home/charlie/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Oh5Jvg5pKG5WVPFj6LPX1kvzuscb04CaNLYGDEeDQCg 51528xxxxxx1@qq.com
The key's randomart image is:
+---[RSA 2048]----+
| oo..oo |
|E. o+ . |
|. .o = |
| .. = . . |
| . o.oS+ . . |
| o +oo= * o |
|. o +.*. B +.o . |
|.+ . o.+o . +oo |
|o. .+ ++o. |
+----[SHA256]-----+
charlie@charlie-virtual-machine:~/work/test$ cat ~/.s
.ssh/ .sudo_as_admin_successful
charlie@charlie-virtual-machine:~/work/test$ cat ~/.ssh/id_rsa
id_rsa id_rsa.pub
charlie@charlie-virtual-machine:~/work/test$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCVWMLzWMm2SAeRWnduXxoC9qY4xPYaTAMPDQs4yCSCnvLAuSmYyMTCGyeBqZREAb8xqQExhG004L8aecJCCqUQkzv5T6prxRJBLaLCrMs9aLXck0eL2aDRgc30SFxE2wXJ8xQJsj6aAh17AF83MqfDUPuBlE+066DXRZSdyVPverrIFcPnHy8SjUJrPJi78F9LcNoDcpUlcoCHDV+4wVn2BLtjGCZiK7XrV6YJOO4Luu0jb7NepzDuFuxkgqiTwMirGWnjND/zOIr80rjOriiPeZZpw1XUqjhk0J 5152872xxxxxx@qq.com
charlie@charlie-virtual-machine:~/work/test$
把,RSA pub key放到 https://github.com/settings/keys 上,保存。
charlie@charlie-virtual-machine:~/work/test$ git clone git@github.com:charlie-xxxxxx/uboot.git
Cloning into 'uboot'...
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (4/4), 12.73 KiB | 0 bytes/s, done.
Checking connectivity... done.
charlie@charlie-virtual-machine:~/work/test$
将日志模板文件设置到Git本地仓库的配置项中,完成日志模板的设置:
git config --global commit.template ~/git_commit_log_template
git配置成 vim编辑格式
git config --global core.editor vim