git使用
创建一个GitHub项目
给项目取个名字
创建成功后页面
使用git上传项目到github
在本地机器上进入要上传项目的文件目录,右键->Git Bash Here
git init #初始化Git仓库,将此文件夹作为git仓库
git add . #将项目上所有的文件添加到仓库中
git commit -m “first commit #表示你对这次提交的注释
git remote add origin https://自己的仓库url地址 #将本地的仓库关联到github上
git push -u origin master #把代码上传到github仓库
git常见命令与问题
本地仓库重新设置源
git commit -m "Change repo." # 先把所有为保存的修改打包为一个commit
git remote remove origin # 删掉原来git源
git remote add origin [YOUR NEW .GIT URL] # 将新源地址写入本地版本库配置文件
git push -u origin master # 提交所有代码
解决 fatal: unable to access ‘https://github.com/…/.git’: Could not resolve host: github.com
#取消代理设置
git config --global --unset http.proxy
git config --global --unset https.proxy
有时候是因为网络被墙的原因,网速慢,重试几次就成功
本文参考: