一、由于mac版本的不同,各种集成的git工具也不同,有些mac还会自带git,有些则需要自动安装,
可以通过下面命令查看是否已经安装git
git --version
如果没安装可去git官网(https://git-scm.com/downloads)
或者参考该文章:https://www.php.cn/faq/506389.html
二、我的mac版本安装git
安装xcode,继承git
xcode-select --install
https://www.knowledgedict.com/tutorial/ml-xcrun-error.html
三、生成密钥
$ git config --global user.name "xxx" 你自己的名字
$ git config --global user.email "xxx@xxx.com" 你自己的邮箱
ssh-keygen -t rsa -C “xxx@xxx.com” (你的邮箱)
cd ~/.ssh进入目录,vi id_rsa.pub打开文件
四、更换项目仓库地址
如果项目存在以前的git,需要删除.git文件,然后执行以下命令从新提交项目
cd进入项目目录
ls -a 查看当前目录下所有的文件
rm -rf .git 删除.git文件echo "# div-follow-input" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main git remote add origin https://github.com/wangAlisa/div-follow-input.git
git push -u origin main
网友评论