Created: 2021-05-28 09:09:58
Modified: 2021-7-29 12:09:56
Git installation and usage.
quickly see
details later, make it quick
|
*origin, origin2 are personal names for repository
to clear commits, 清除github所有历史提交记录的方法 (ops-coffee.cn)
for private email, git - Error “Your push would publish a private email address” - Stack Overflow, then change email in ,
- Projects - AppVeyor, setting-envs
install
check your installation using command line( like Git CMD, Git Bash):
|
windows 10
official website:
Git for Windows or Git - Downloads (git-scm.com)
you can refer to( remember your installation directory of git if you want to set it as environment variable later):
Windows系统Git安装教程(详解Git安装过程)_IT技术实战-CSDN博客
*set {installation directory}\cmd\git.exe
as environment variable in Path
if you want to use it in other command line like cmd.exe
Ubuntu/Debian
For the latest stable Git version in Ubuntu/Debian:
|
basic use
you can create a new repository or clone a existing one
create new repository
create a local repository(版本库), a directory of ‘.git’, in the ‘directory ‘ using Git Bash :
|
clone existing repository
clone a existing repository in ‘directory ‘ using Git Bash:
|
Configure repository
check your configuration:
|
set your information for local repository before “commit”:
|
more configuration, refer to Git 创建仓库 | 菜鸟教程 (runoob.com)
work with repository
more use, refer to Git 仓库基础操作 - Gitee, Git 基本操作 | 菜鸟教程 (runoob.com), Git 远程仓库(Github) | 菜鸟教程 (runoob.com), Git Gitee | 菜鸟教程 (runoob.com).
*you can place your remote repositories in Github, preparation see [prepare with Github](# prepare with Github).
checkout
refer to git checkout 命令详解,
Git GUI use
refer to 使用Git 总结-msysGit与GitHub 使用_荒野之鹰-CSDN博客 or Windows平台下Git的安装msysgit与配置_睡得香吃得好胆子大的专栏-CSDN博客
prepare with Github
configure your account SSH Key, refer to 使用 SSH 连接到 GitHub - GitHub Docs
Create SSH Key
check existing keys:
|
*”~/.ssh” is the default directory of SSH keys.
otherwise, create a SSH key for your device using Git Bash:
|
*algorithm(optional): rsa [-b 4096], ed25519(recommend).
Configure ssh-agent
ssh-agent stores unencrypted keys in memory( for Unix-like OS) and communicates with SSH clients using a Unix domain socket
run ssh-agent using Git Bash:
|
check keys loaded in the ssh-agent:
|
if none, add SSH private key to the ssh-agent:
|
*SSH private key example: ~/.ssh/id_ed25519
switch off the agent using Git Bash, refer to ssh agent详解 - 知乎 (zhihu.com):
|
*if not use agent, there maybe warnings, solution refer to: Win10 从零搭建Git环境_feng991254的专栏-CSDN博客 or win10 git环境搭建_ydf8525的专栏-CSDN博客
Add SSH key to Github
- open responding SSH public key with a editor like Notepad, then copy the contents of the .pub file to your clipboard,
*SSH public key example: ~/.ssh/id_ed25519.pub, so you can print it in line:
|
- go into your own Github setting -> SSH and GPG keys, and create a new SSH key,
then give a name of the key filling in the “title”, and paste the SSH public key contents into the “Key” field.
- test SSH connection:
|
if something wrong, baidu or google.
prepare with Gitee
configure your account SSH Key
Create SSH Key
check existing keys:
|
*”~/.ssh” is the default directory of SSH keys.
otherwise, create a SSH key for your device using Git Bash:
|
*algorithm(optional): rsa [-b 4096], ed25519(recommend).
Add SSH key to Gitee
- open responding SSH public key with a editor like Notepad, then copy the contents of the .pub file to your clipboard,
*SSH public key example: ~/.ssh/id_ed25519.pub, so you can print it in line:
|
- go into your own Gitee setting -> SSH keys, then fill the blank and add a new SSH key: give a name of the key filling in the “title”, and paste the SSH public key contents into the “Key” field.
- test SSH connection:
|
if something wrong, baidu or google.
more about git
谈谈 Git 存储原理及相关实现 - 知乎 (zhihu.com),
看完这篇还不会用Git,那我就哭了! - 知乎 (zhihu.com),
http://git.oschina.net/progit/,
https://www.liaoxuefeng.com/wiki/896043488029600/896067008724000,