傻瓜式安装
查看版本git --version
通过以下指令配置用户名和邮箱
git config --global user.name "your_name"
git config --global user.email "your_email@gmail.com"
git config core.ignorecase false // 本地仓库文件是否大小写敏感
查看是否配置成功git config --list
生成密钥
如果是第一次配置,输入以下命令,中途一直enter就好了,直到出现一个矩形方框
ssh-keygen -t rsa -C "your_email@youremail.com"
查看是否生成密钥
cd ~/.ssh //会出现 id_rsa id_rsa.pub 两个文件
关联仓库
GitHub为例
右上角打开Settings->SSH and GPG keys,,new ssh key 将id_rsa.pub的内容复制过去
git init
// 初始化git add README.md
//创建README.md(如果没有)对其跟踪git commit -m “message”
//提交到本地仓库git status
//查看文件状态git remote add [你的仓库名] [你的github的URL]
git pull [你的仓库名] master
//默认master分支git push -u [你的仓库名] master
//第一次提交加-u ,第二次就不用加)
本文由 阿俊 创作,如果您觉得本文不错,请随意赞赏
采用 知识共享署名4.0 国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
原文链接:https://jinterest.cn/archives/macos-git
最后更新:2020-11-19 13:21:50
Update your browser to view this website correctly. Update my browser now