前提
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