1、初始化git仓库在需要上次的代码文件夹中使用命令git init也可以图形化操作。2、设置用户名和邮箱git config user.name Repo-specific Name git config user.email repo.emailexample.com3、链接远程git仓库其中 origin为远程仓库在本地的别名。https://github.com/用户名/仓库名.git 为远程仓库地址可以为http或者SSHgit remote add origin https://github.com/用户名/仓库名.git图形化工具点击Add Remote之后输入远程仓库地址即可链接远程仓库。可通过以下代码查看链接的远程仓库。git remote -v链接成功远程仓库之后就是正常的上次代码。