文章目录
1. Git
2021/02/22/9:25
下载安装与启动基本配置
搜索引擎搜索git,访问官网
右下角download会自动选择版本进行下载
等待下载并安装点击下一步
启动git
开始菜单会有3个git,或任意文件夹下右键
Git bash //最常用 类linux命令
git cmd
git gui
//建一个文件夹做仓库repos, 子文件夹是project
Linux命令
在project内右键git bash here输入一些命令
cd //改变目录
cd.. //切换到上级目录
pwd //当前目录
ls //list显示所以文件
clear //清屏
reset //重启
history //历史信息
操作命令
touch //创建文件
mkdir //make文件夹
mv //move
rm src //删除文件
rm -r src //删除文件夹
#remove!!!慎用我不小心就把之前的这篇markdown删了现在重写ing; rm src好像也能用
设置用户和邮箱
git config --global user.name "Quanlong" #名称
git config --global user.email 2577828769@qq.com #邮箱
git config --global --list
基本理论
抽象:工作区 -> 暂存区 -> 版本库 -> 远程仓库
add commit push
____________________________________________________________________
OS: 工作区就是文件夹 目标文件夹 上传
add复制到剪切板 commit粘贴到目标文件夹 push就是上传
____________________________________________________________________
当文件改动完成后使用 [git add .]提交暂存区
工作目录修改文件
将文件暂存 git add .
提交commit commit -m""
push上传 git push
因此文件有三种状态已修改modified,staged,committed
工作中把代码放到工作空间内
git add . 添加到暂存区
git status 检查状态
git commit -m"" 提交
git push 上传
常见命令
git init //初始化.git文件//隐藏
或者
git clone [url] //将远程仓库中pjt拉下来
git add . //1
git commit -m "" //2
git push //3
git pull //拉取远程到本地
基本熟悉上述5个命令即可基本进行操作
git status //文件状态
git ignore
可以自定义忽略文件不上传,在主目录创建".gitignore"文件
#为注释
*.txt //忽略所有
!lib.txt #例外规则,不被忽略
/temp 向上忽略
build/ 忽略文件夹下所以
doc/*.txt 会忽略doc文件夹下所以.txt
码云和配置ssh公钥
注册码云账号
打开复制内容
任意目录: git bash here
ssh-keygen -t rsa
两下空格忽略密码
会生成C:\Users\Administrator\.ssh\*.pub文件
打开复制
回到码云/设置/安全设置/ssh公钥进行添加
新建仓库,仓库名,简介,readme
复制仓库http地址
回到git bash
输入
git clone [url]
到这里你的电脑里已经有了clone下来的仓库,你可以在仓库里把写好的代码放进去然后使用命上传
git add .
git commit -"msg"
git push
基本使用
git add .
git commit -m""
git push
Bash命令简要说明
cd //Change Directory 的缩写;转到指定目录
ls //List 的缩写;列出当前目录中的内容
mkdir //Make Directory 的缩写;在当前目录中创建一个新的目录
pwd //Present Working Directory 的缩写;显示当前工作目录
touch //创建一个指定名称的空新文件
rm //Remove 的缩写;删除指定文件
rmdir //Remove Directory 的缩写;删除指定目录
cp //Copy 的缩写;拷贝指定文件
mv //Move 的缩写;移动指定文件
cat //Concatenate 的缩写;在屏幕中显示文件内容
chmod //Change Mode 的缩写;改变文件的权限
man //Manual 的缩写;显示指定命令的使用说明
2.picgo和gitee
转载;
完成下步骤后只需要f1截图粘贴到typora里即可自动上传
PicGo + Gitee(码云)实现markdown图床
https://www.jianshu.com/p/b69950a49ae2
手把手教你用Typora自动上传到picgo图床【教程与排坑】
https://blog.csdn.net/disILLL/article/details/104944710
success!
3. 杂项
iml报错
原因:红色是因为你安装了版本控制工具(例如git,svn等),更新了代码,没有提交上去,起提示作用,不影响实际功能; 解决办法:选择file–>setting–>version Controller,然后把vcs选项选择为none就ok了
git pull origin master
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://gitee.com/quanlongcs/android.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
解决方法
git pull origin master
将多个repos(不用)移动到一个repos仓库里
git
Administrator@USER-20210124BS MINGW64 /d/Repository/gitee/repositories (master)
$ git add .
warning: adding embedded git repository: android
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint: git submodule add <url> android
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached android
hint:
hint: See "git help submodule" for more information.
warning: adding embedded git repository: ds-and-algs
warning: adding embedded git repository: linux
//解决方法: 删除多个repos下的.git文件夹
2021年6月5日16:50:57
443
fatal: unable to access ‘https://github.com/QuanlongCS/QuanlongCS.github.io.git/’: OpenSSL SSL_connect: Connection was reset in connection to github.com:443
可能是因为使用过vpn或者代理,关机时忘记关了。
解决方案:cmd下命令执行 ipconfig/flushdns
清理dns缓存