Git
首先git --version查看是否安装git?我的MBP不知道什么时候已经装过,版本git version 2.23.0。
Commit a project
首先,cd /Users/yourusername/Workspace/yourproject进入要提交的项目目录。
然后,创建一个.gitignore文件,将无需提交的目录写进去。
初始化先,git init。
添加git add .
提交git commit -a
Commit to Github
For the 1st time
第一次提交代码到github需要
ssh-keygen -t ed25519 -C "***@hotmail.com"
很奇怪,系统报zsh: command not found: $。通过which ssh-keygen命令看,是安装了的/usr/bin/ssh-keygen。无奈用了全路径/usr/bin/ssh-keygen -t ed25519 -C "***@hotmail.com"。
按照文档pbcopy < ~/.ssh/id_ed25519.pub将数据copy到粘贴板。
vi ./git/config
Commit
git remote add origin https://github.com/yourorg/yourproject.git
git push --set-upstream origin main
git remote add origin git@github.com:landingsiteteam/smartools-frontend.git
git branch -M main
推文件
git push
拉文件
git pull
Git Clone
用git clone命令从github拉项目,git@github.com:landingsiteteam/isomaker.git。
打开terminal,先cd /Users/***/Workspace工作目录,然后执行git clone git@github.com:***/yourproject.git,系统追自动创建yourproject目录。git地址可以从github页面copy。
本文档介绍了如何使用Git进行代码管理,包括检查Git版本、初始化项目、创建.gitignore文件、提交本地代码、设置SSH密钥、将代码推送到Github以及克隆远程项目。详细步骤涵盖从本地提交到远程仓库的全过程。
766

被折叠的 条评论
为什么被折叠?



