diff --git a/_posts/2024-11-21-Git_fixed.md b/_posts/2024-11-21-Git_fixed.md new file mode 100644 index 0000000..636dfd3 --- /dev/null +++ b/_posts/2024-11-21-Git_fixed.md @@ -0,0 +1,127 @@ +## Git : + +```powershell + +#Company Account : + +C:\Users\shunduan>ssh -T git@github.com +#Hi yayalingo! You've successfully authenticated, but GitHub does not provide shell access. + +### 解决推送被拒绝的问题 + +1. **拉取远程仓库最新更改**: + + ```bash + git pull origin main + + ``` + +2. **解决任何冲突并提交(如果有冲突)**: + - 打开并编辑有冲突的文件,解决冲突 + - 然后执行以下命令 + + ```bash + git add . + git commit -m "Resolved merge conflicts" + + ``` + +3. **推送本地更改到远程仓库**: + + ```bash + git push -u origin main + + ``` + + +### Git 常用命令 + +### 初始化和配置 + +```bash +git init # 初始化一个新的Git仓库 +git clone # 克隆远程仓库 +git config --global user.name "Your Name" # 设置用户名 +git config --global user.email "your_email@example.com" # 设置用户邮箱 +git remote add origin https://github.com/yayalingo/Sanya.github.io.git #添加远程link +``` + +### 基本操作 + +```bash +git status # 查看仓库当前状态 +git add . # 添加所有更改的文件到暂存区 +git commit -m "Commit message" # 提交更改并添加提交消息 +git pull origin main # 拉取远程仓库最新更改并合并到本地 +git push origin main # 推送本地更改到远程仓库 + +``` + +### 分支操作 + +```bash +git branch # 列出所有本地分支 +git branch # 创建一个新分支 +git checkout # 切换到指定分支 +git merge # 合并指定分支到当前分支 +git branch -d # 删除指定分支 + +``` + +### 日志和查看 + +```bash +git log # 查看提交历史 +git diff # 查看未暂存的更改 +git show # 显示指定提交的详细信息 + +``` + +这些命令应该覆盖了大多数常见的 Git 操作场景。如果你需要更详细的命令或帮助,随时可以使用 `git help ` 来查看具体命令的详细用法。例如: + +```bash +git help push + +``` + +希望这些简化的指南和常用命令能够帮助你更有效地使用 Git。 + +Push - + +- 初始化仓库并添加文件: + + ```bash + + Copy + git init + git add yayalingo.github.io/ + git commit -m "Initial commit" + + ``` + +- 添加远程仓库并推送: + + ```bash + git remote add origin git@github.com:yayalingo/yayalingo.github.io.git + git push --set-upstream origin master + + ``` + + +Path : C:\Users\shunduan\OneDrive - Magna\Desktop\file\KB\GItHub_Page + +## Jekyll + +```powershell +bundle exec jekyll serve #本地查看页面Jekyll +bundle exec jekyll serve --baseurl="" +``` + +https://jekyllrb.com/showcase/ + +We only cover RubyInstaller-2.4 and newer here. Older versions need to [install the Devkit](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit) manually. + +1. Download and install a **Ruby+Devkit** version from [RubyInstaller Downloads](https://rubyinstaller.org/downloads/). Use default options for installation. +2. Run the `ridk install` step on the last stage of the installation wizard. This is needed for installing gems with native extensions. You can find additional information regarding this in the [RubyInstaller Documentation](https://github.com/oneclick/rubyinstaller2#using-the-installer-on-a-target-system). From the options choose `MSYS2 and MINGW development toolchain`. +3. Open a new command prompt window from the start menu, so that changes to the `PATH` environment variable becomes effective. Install Jekyll and Bundler using `gem install jekyll bundler` +4. Check if Jekyll has been installed properly: `jekyll -v` \ No newline at end of file