git学习总结

git命令

查看所有信息

git config --list

配置用户信息

git config --global user.name correns //设置用户名
git config --global user.emal lpbeijing //设计邮箱名称

如果存在配置错误例如

[email protected]

执行后删除

git config --global --unset user.ame

配置github信息认证信息

bogon:react localhost$ ssh-keygen -t rsa -C '[email protected]'
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/localhost/.ssh/id_rsa): 
/Users/localhost/.ssh/id_rsa already exists.
Overwrite (y/n)? n
bogon:react localhost$ ls /Users/localhost/.ssh/id_rsa.pub
/Users/localhost/.ssh/id_rsa.pub

在github网上新增ssh key中填写刚刚生成的文件id_rsa.pub中的内容


git学习总结_第1张图片

验证

bogon:react localhost$ ssh -T [email protected]
Hi Correns! You've successfully authenticated, but GitHub does not provide shell access.

获取地址


git学习总结_第2张图片

下载github上的代码

bogon:react localhost$ git clone [email protected]:Correns/imoocmanager.git
Cloning into 'imoocmanager'...
remote: Enumerating objects: 283, done.
remote: Counting objects: 100% (283/283), done.
remote: Compressing objects: 100% (196/196), done.
remote: Total 283 (delta 60), reused 273 (delta 50), pack-reused 0
Receiving objects: 100% (283/283), 13.35 MiB | 47.00 KiB/s, done.
Resolving deltas: 100% (60/60), done.

然后在本地修改代码之后提交

git add .
git commint -m 'add prettier rules'
git push origin 

就可以在github上看到最新提交的代码


git学习总结_第3张图片
git push之后

好记性不如烂笔头,多多记录自己需要的才能记牢

参考文章:https://www.jianshu.com/p/7edb6b838a2e

你可能感兴趣的:(git学习总结)