使用Git将本地代码上传到GitHub


创建本地仓库

在本地环境项目目录下打开Git Base Here,输入git init 命令.

配置全局变量

git config --global user.name "GitHub用户名"
git config --global user.email "GitHub登陆邮箱"

添加到本地仓库

  1. 本地项目目录的文件添加到暂缓区.
    git add . (. 表示所有文件)
  2. 暂缓区的文件提交到本地仓库
    git commit -m "注释信息"

本地仓库和GitHub仓库关联

git remote add origin https://github.com/xxxxx/xxxxx.git

代码从本地仓库上传到GitHub仓库

git pull origin master
git push origin master

更新远程仓库代码到本地

git fetch origin master

文章作者: Lanren
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Lanren !
  目录