git常用命令

一个人寂寞地码代码,也要和不同设备上的自己合作交互哦。

1
2
$ git init
#始化空git文件夹
1
2
$ git clone ssh://username@host/programname.git "文件夹"
#克隆项目
1
2
$ git pull
#更新项目
1
2
3
4
5
$ git add.
#提交文件至暂存区

$ git commit -m [message]
#提交文件至仓库区
1
2
3
4
5
#免密码设置:
$ git config --global user.name "hehe"
$ git config --global user.email "hehe@xx.com"
$ ssh-keygen -t rsa -C "heheKey"
#执行后的输入全部为空,直接回车就好;复制id_rsa.pub文件内容在版本库用户个人资料里设置SSH Keys。

OpenSSH 8.8起,默认不支持 ssh-rsa。找到Git安装目录下etc\ssh\ssh_config文件,在文件最后加入:
Host *
PubkeyAcceptedKeyTypes +ssh-rsa
HostKeyAlgorithms +ssh-rsa