前提
1.电脑已经有git(在终端输入git可以查询到)
2.有GitHub账号
第一步:进入打算保留网上工程 的文件夹,初始化一个git仓库
cd /Users/fanqiusha/testgit03040548
git init
第二步:设置git的username和email(对应GitHub)
git config --global user.name "fanqiusha"
git config --global user.email "15010323266@163.com"
第三步:创建ssh key
1.ssh-keygen -t rsa -C "15010323266@163.com"
2.回车,输入y,(是否愿意,表示重复覆盖)回车,当要求输入秘密时,直接回车,回车,不设置密码
3.打开/Users/jiazijie/Desktop/.ssh目录下的id_rsa.pub文件获取key(因为之前已经存在.ssh,所以路径也不一样)
cat /Users/jiazijie/Desktop/.ssh/id_rsa.pub
4.将复制到的新的key在github上更新ssh
5.验证链接
ssh -T git@github.com
如果看到成功successfully 就表示ok
第三步:从gitHub上下载项目,复制clone and download的地址https://github.com/fanqiusha/web.git
git clone https://github.com/fanqiusha/web.git
第四步:提交修改的文件到GitHub
、、、、、、、、、、、、、、、、、下面的还没试
查看状态: git status
可以添加文件或者目录,也可以使用通配符。比如:
git add Readme.md # add file only
git add *.cpp # add all cpp files
git add /home/code/ # add all files in /home/code
git commit