github基础

173 阅读1分钟

使用git

cmd命令:

cd .. (上一级目录) 切换磁盘,需要使用d:
dir
echo "">1.txt
mkdir
ping   www.baidu.com
ipconfig  -- 查看网卡信息
taskkill 
netstat -ano
net

linux

cd
ls
tree
ping
ifconfig

语法

git config --global user.name ""
git config --global user.email ""
1.git init  初始化工具
2.git status    查看目前状态
3.git add .     将工作区的代码,.代表all
4.git commit -m "注释内容"   提交
5.git log   查看版本库中有哪些版本
6.git diff      差异不同
7.git reset --hard ""   充值hard
8.git reflog
9.git branch  分支
10.git remote  
11.git clone   复制

使用远程仓库

上传github仓库代码

git init 
git status
git add .
git commit -m ""
git remote add origin https://……
git push -u origin master

常见问题

(一)origin已存在
    1.git remote remove origin   删除origin变量
      git remote add origin https://……
    2.git remote add origin1 https://……设置不同的变量名

免密上传

1.在本地生成公私钥  ssh-keygen -t rsa
2.将公钥放到github上去  ssh -T git@github.com

修改的代码重新上传

git add .
git commit -m "注释内容"
git push origin master

利用gitpage打开我的网页

1.创建分支  git branch gh-pages
2.切换分支  git checkout gh-pages