ubuntu20.04安装了几次2.0都失败
ubuntu12.04已经无法安装系统本身的更新了,更别说安装其他软件
强迫症发作,于是有了这次:
列出大致步骤吧,主要是有些error要如何解决
git
install git
git --version
sudo apt install git
git --version
set up git
Username
github用户名
git config --global user.name "qiuhaidong"
#or haydnyau
github登录帐号邮箱名
git config --global user.email "690982322@qq.com"
#or 1148891016@qq.com
Password caching
To use this option, you need to turn on the credential helper so that git will save your password in memory for some time:
git config --global credential.helper cache
添加 SSH Keys
Step 1: Check for SSH keys
First, we need to check for existing ssh keys on your computer. Open up Terminal and run:
cd ~/.ssh
# Checks to see if there is a directory named ".ssh" in your user directory
If it says “No such file or directory” go to step 2. Otherwise, you already have an existing keypair, and you can skip to step 3.
最好就是把 .shh 这个文件夹删除了,做step 2
Step 2: Generate a new SSH key
To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.不要输入文件名
ssh-keygen -t rsa -C "your_email@example.com"
我的就是:ssh-keygen -t rsa -C "690982322@qq.com"
#or 1148891016@qq.com
Now you need to enter a passphrase.设置密码。(有人是密码都不要的,再按两下enter就行了)
Which should give you something like this:
Your identification has been saved in /home/you/.ssh/id_rsa.
Your public key has been saved in /home/you/.ssh/id_rsa.pub.
The key fingerprint is:
01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com
Step 3: Add your SSH key to GitHub
ctrl+h,显示隐藏文件,这里其实可以打开这个id_rsa.pub文件,直接复制,不用安装下面的软件
sudo apt-get install xclip
# Downloads and installs xclip.
xclip -sel clip < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard
Add your SSH key to GitHub
到github网站,登陆,头像,设置,SSH and GPG keys,把旧的SSH keys删除,添加新的,title不用管,粘贴到key就行了
Step 4: Test
ssh -T git@github.com
这里可能会还要按照提示做一下,不难,看英文做
如果看到:
Hi qiuhaidong! You've successfully authenticated, but GitHub does not provide shell access.
# or haydnyau
If that username is correct, you’ve successfully set up your SSH key. Don’t worry about the shell access thing, you don’t want that anyway.
If you see “access denied” please consider using HTTPS instead of SSH. If you need SSH start at these instructions for diagnosing the issue.
如果不成功,用https的认证方式代替ssh,因为github觉得ssh不安全,认证方式有时会改变
RVM
看官网命令
rvm --version
gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
会显示失败,先不管它
Install RVM:命令
curl -sSL https://get.rvm.io | bash -s stable
如下:
dong@Ubuntu:~$ curl -sSL https://get.rvm.io | bash -s stable
Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc
gpg: 于 2021年01月16日 星期六 02时46分22秒 CST 创建的签名,使用 RSA,钥匙号 39499BDB
gpg: 无法检查签名:没有公钥
GPG signature verification failed for '/home/dong/.rvm/archives/rvm-1.29.12.tgz' - 'https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc'! Try to install GPG v2 and then fetch the public key:
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
or if it fails:
command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
command curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
In case of further problems with validation please refer to https://rvm.io/rvm/security
这个提示错误,并且给出了解决方法:
运行:
命令1:
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
命令2:
curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
再运行上一条命令安装rvm:
curl -L https://get.rvm.io | bash -s stable
输出:
* To start using RVM you need to run `source /home/dong/.rvm/scripts/rvm`
安装成功,按照提示运行:
source /home/dong/.rvm/scripts/rvm
测试:
rvm --version
git --version
安装ruby2.2.6(1.9.3太久了,无法安装)
rvm install 2.2.6
会提示输入本机密码
rvm use 2.2.6
Setup Octopress
git clone -b source git@github.com:qiuhaidong/qiuhaidong.github.com.git octopress
# 或者 git clone git://github.com/imathis/octopress.git octopress
# octopress 2.0 原码
cd octopress
install dependencies
gem install bundler
会提示失败,按提示加上版本号,安装适合本系统的
bundle install
Install the default Octopress theme
rake install
Deploying to Github Pages
rake setup_github_pages
这里可能会要输入链接等,ssh,https
The rake task will ask you for a URL of the Github repo. Copy the SSH or HTTPS URL from your newly created repository
(e.g. git@github.com:username/username.github.io.git)
git@github.com:qiuhaidong/qiuhaidong.github.com.git
https://github.com/qiuhaidong/qiuhaidong.github.com.git
or
git@github.com:haydnyau/haydnyau.github.io.git
https://github.com/haydnyau/haydnyau.github.io.git
and paste it in as a response.
This will:
- Ask for and store your Github Pages repository url.
- Rename the remote pointing to imathis/octopress from ‘origin’ to ‘octopress’
- Add your Github Pages repository as the default origin remote.
- Switch the active branch from master to source.
- Configure your blog’s url according to your repository.
- Setup a master branch in the _deploy directory for deployment.
Next run:
rake generate
rake deploy
This will generate your blog, copy the generated files into _deploy/
, add them to git, commit and push them up to the master branch. In a few seconds you should get an email from Github telling you that your commit has been received and will be published on your site.
来自官网
下面这个不知道要不要做:
Now you have a place to commit the generated content for your site, but you should also set up repository to store the source for your blog. After you set up a repository for your blog source, add it as the origin remote.
git remote add origin (your repo url)
# set your new origin as the default branch
git config branch.master.remote origin
Now push your changes and you’ll be all set.
上面这个不知道要不要做:
来自官网
Don’t forget to commit the source for your blog.
git add .
git commit -m 'update'
git push origin source
Configuring Octopress
edit _config.yml
url: # 不管
title: # 丘海东
subtitle: # Haydn Yau
author: # 丘海东
paginate: 10 # 主页文章数
recent_posts: 20 # 主页显示最近文字标题数
# list each of the sidebar modules you want to include, in the order you want them to appear.
# To add custom asides, create files in /source/_includes/custom/asides/ and add them to the list like 'custom/asides/custom_aside_name.html'
default_asides: [asides/category_list.html注意,这里添加侧边栏,看另一篇博文, asides/recent_posts.html, asides/github.html]
github_user: haydnyau
一些命令:
rake new_post["title"]
rake generate
rake preview
rake deploy
pull.sh
#!/bin/sh
cd /home/dong/octopress
git pull origin source
rake generate deploy
push.sh
#!/bin/sh
cd /home/dong/octopress
rake generate deploy
git add .
git commit -m 'update'
git push origin source
记得右键,属性,权限,程序执行文件