1、更改remote从https改为ssh
#查看git的状态
git remote -v
#origin https://github.com/qingjian1991/Manec (fetch)
#origin https://github.com/qingjian1991/Manec (push)
#更改git的属性
git remote set-url origin git@github.com:qingjian1991/Manec.git
git remote -v
#origin git@github.com:qingjian1991/Manec.git (fetch)
#origin git@github.com:qingjian1991/Manec.git (push)
2、创建新的仓库并且上传文件
在GitHub上创建新的仓库,并且不要添加README, .gitignore or License file等文件
# create a new directory, and initialize it with git-specific functions
git init my-repo
# change into the `my-repo` directory
cd my-repo
# create the first file in the project
touch README.md
# git isn't aware of the file, stage it
git add README.md
# take a snapshot of the staging area
git commit -m "add README to initial commit"
# provide the path for the repository you created on github
git remote add origin https://github.com/YOUR-USERNAME/YOUR-REPOSITORY-NAME.git
# push changes to github
git push --set-upstream origin main
3、从远处仓库拉取文件并比较本地的差异
git pull origin main
#From github.com:qingjian1991/Jerry
#* branch main -> FETCH_HEAD
#Already up-to-date.