1、初始化git仓库

在需要上次的代码文件夹中使用命令:

git init

也可以图形化操作。

2、设置用户名和邮箱

git config user.name "Repo-specific Name"
git config user.email "repo.email@example.com"

3、链接远程git仓库

其中 origin为远程仓库在本地的别名。

https://github.com/用户名/仓库名.git 为远程仓库地址,可以为http或者SSH

git remote add origin https://github.com/用户名/仓库名.git

图形化工具,点击Add Remote之后,输入远程仓库地址,即可链接远程仓库。

可通过以下代码查看链接的远程仓库。

git remote -v

链接成功远程仓库之后就是正常的上次代码。

更多推荐