git的日常使用

首次上传项目到github上

在项目上右击——>选择  Git Bash Here  直接进入到存放项目文件的地址

git init     在当前项目的目录中生成本地的git管理

git add .   将项目上的所有的文件添加到仓库中,如果想添加某个特定的文件,只需要把 . 换成这个文件名就可以了

git commit "注释"  对这次提交的项目进行注释

这时可能会弹出让你输入用户名和密码的输入框

git romote add origin  https://github.com……       https://github.com……这个是自己的仓库url地址,当你在github中创建仓库时会有,这里是将本地仓库关联到github上

git  push -u origin master  将代码上传到github上

再次上传项目到远程仓库

  在项目上右击——>选择  Git Bash Here  直接进入到存放项目文件的地址

git add .

git commit -m "注释"

git push origin master

拉取远程仓库到本地

在项目上右击——>选择  Git Bash Here  直接进入到存放项目文件的地址

  git pull origin master

 

下面是使用git出现的错误以及解决方法

 问题:fatal: unable to access 'https://github.com/whjybear/nuoge.git/': Could not resolve host: github.com         (这个错误在输入 git push origin master时出现)

解决方法:git config  --global --unset http.proxy

     git config  --global --unset https.proxy

 

posted @ 2020-03-13 21:21  山吹同学  阅读(85)  评论(0编辑  收藏  举报