从https://git-scm.com/downloads下载后无脑运行安装。
Git Bash
下载安装后需运行"Git Bash",在此下运行git命令。
权限控制
===在Git Bash下生成rsa key如下:
zhang@DESKTOP-CTS7DTP MINGW64 /d/mygit (master)
$ ls ~/.ssh/
known_hosts
zhang@DESKTOP-CTS7DTP MINGW64 /d/mygit (master)
$ ssh-keygen -t rsa -b 2048 -C "XXXXXXX@163.comm"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/zhang/.ssh/id_rsa):
/c/Users/zhang/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/zhang/.ssh/id_rsa.
Your public key has been saved in /c/Users/zhang/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:O2nIyBTvpB9aRnRwAcc3BTa99rkI4+HLcV6WVS4pQcM boyfriend_1980@163.comm
The key's randomart image is:
+---[RSA 2048]----+
| oo+.+=+ |
| +..ooE. |
| . . .. ... .|
| + . o. o.|
| . + S ...o.o|
| o B . o+ .o+ |
| + B =o.+..+. |
| = o oo+.o. |
| . . o.. |
+----[SHA256]-----+
zhang@DESKTOP-CTS7DTP MINGW64 /d/mygit (master)
$ eval "$(ssh-agent -s)"
Agent pid 24800
zhang@DESKTOP-CTS7DTP MINGW64 /d/mygit (master)
$ eval "$(ssh-agent -s)"
Agent pid 25292
zhang@DESKTOP-CTS7DTP MINGW64 /d/mygit (master)
$ ls ~/.ssh/
id_rsa id_rsa.pub known_hosts
zhang@DESKTOP-CTS7DTP MINGW64 /d/mygit (master)
$ ssh-add ~/.ssh/id_rsa
Enter passphrase for /c/Users/zhang/.ssh/id_rsa:
Identity added: /c/Users/zhang/.ssh/id_rsa (/c/Users/zhang/.ssh/id_rsa)
zhang@DESKTOP-CTS7DTP MINGW64 /d/mygit (master)
$
===上传publich key
在 gitee=>设置=>安全设置=>SSH公钥 里将生成好的id_rsa.pub的内容传到编辑框里点保存即可。
新建项目
gitee新建一项目。
如下命令安装
$ git init // 初始化目录
$ git config --global user.name "vagrantisme" // 设置用户名
$ git config --global user.email "XXXX@163.com" // 设置邮箱地址
$ git config --global color.ui true
$ git config -l // 显示全局设置
zhang@DESKTOP-CTS7DTP MINGW64 /d/mygit (master)
$ git clone git@gitee.com:vagrantisme/it_technical_roadmap.git // 在本地电脑上同步云上代码
Cloning into 'it_technical_roadmap'...
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)
Receiving objects: 100% (4/4), done.