github
- 设置账号和密码:
git config --global user.name Gavin188
git config --global user.email 63292933@qq.com
- 查看用户的账号和密码:
git config --global -l
- 修改配置文件
vim ~/.bash_profile
#添加代理
export http_proxy ='http://name:password@ip:port'
export htpps_proxy='http://name:password@ip:port'
- 设置git代理
git config --global http.proxy name:password@ip:port
git config --global https.proxy name:password@ip:port
- 下载git文件
git clone https://github.com/Gavin188/WGT.git;
- 提交文件
#创建文件
mkdir wgt
#提交文件
git add wgt
#提交到本地
git commit
git commit -m '备注'
#提交到git
git push -u origin master
# 更新代码
git pull
- 查看工作目录和暂存区的差别
git diff
- 创建并切换分支
git checkout -b newbranch
10 本地代码上传到GitHub
https://www.jianshu.com/p/7798186523ee
出现的问题
- 提交文件
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
解决方案:https://www.jianshu.com/p/7798186523ee
- 在上传本地代码到github仓库时,
$ git remote add origin https://github.com/jennaqin/jennaqin.github.io.git
fatal: remote origin already exists.
先移除
git remote rm origin
再次添加
git remote add origin https://github.com/jennaqin/jennaqin.github.io.git
fatal: Couldn't find remote ref master'
翻译过来就是:致命的:无法找到远程参考主,也就是报错的意思。错误的提示内容意思是找不到需要连接的对象。
-解决办法:
git remote rm origin
git remote add origin XXXX