提示:本文用于学习记录
文章目录
一、本地项目上传 git
- 下载安装 git 客户端,根据系统下载对应版本
- 官方下载地址:http://git-scm.com/download/
- 安装完成后点击 Git Bash,打开命令行窗口
- 进入如下页面,创建并进入 TEST 文件夹
- 通过命令 git init 把这个文件夹变成 Git 可管理的仓库
- 将项目粘贴到这个本地 Git 仓库里
- 使用 git status 查看当前的状态
- 通过 git add . 把该目录下的所有文件添加到仓库,注意点是用空格隔开的
- 再次使用 git status 查看当前的状态
- 用 git commit 把项目提交到仓库
- 登陆 Github,点击 New repository 新建一个项目
- 执行指令:git remote add origin ~,关联 git 仓库
- 上传本地代码:git push -u origin master(这里可能网络不好)
二、问题解决
报错信息:
fatal: unable to access 'https://github.com/yjy249/distance_object.git/': Could not resolve host: github.com
解决方案:
//取消http代理
git config --global --unset http.proxy
//取消https代理
git config --global --unset https.proxy
总结
以上就是本地项目上传 github 的具体步骤与问题解决。