Because my blog system Hexo is hosted on the gitcafe above, so for Gitcafe and GitHub has a relatively strong interest, the previous period of time and git learned a bit, is just into a door bar; there is a gitcefe-pages branch on Gitcafe, Can be used to show us a page, give us a free space, but also can use its two-level domain name, but the project name and ****.gitcafe.com (two level domain name), and an account can only have one such page;
If we want to set up a page, first we need to apply for a Gitcafe account (GitHub also has this feature, but not so fast) my Gitcafe homepage look gitcafe This name, it must be related to git, So we have to install Git on the computer (I use the Windows system) in my previous blog has a detailed description of how to install Hexo blog, the first time you register, to add the SSH key on the gitcafe, SSH seems to be a cryptographic protocol, is equivalent to verifying our identity, because our own computer is on-premises, and the server side is at the far end, so we need a secure transport protocol, the first time I added this I also engaged for a long time, do not know how to do, more than a few times it is clear;
If we are using Gitcafe for the first time, we need to create a new SSH key;
On your own computer, you need to submit a managed location, git bash and then go to a window interface and enter the following command:
CD ~/.ssh
Enter the SSH directory, or you can manually create one yourself if you do not have this directory, or you can enter a command to create:
mkdir ~/.ssh
Next we're going to create a new key:
Ssh-keygen-t rsa-c "[Email protected]"
change the e-mail address into your own;
You will then be prompted with the following information;
$ ssh-keygen-t rsa-c "[email protected]" generating public/private RSA key pair. Enter passphrase (empty for no passphrase): Enter same passphrase Again:your identification have been saved In/c/users/user Name/.ssh/id_rsa. Your public key have been saved in/c/users/username/.ssh/id_rsa.pub.the key fingerprint is:15:81:d2:7a:c6:6c:0f:ec:b0:b6 :D 4:18:b8:d1:41:48 [email protected]
In
which we need to enter passphrase, this is what we need to enter the password;
Then, our SSH key is generated, we can go to the user directory (~/.ssh/) to see the private key id_rsa
and public key id_rsa.pub
Two files, Id_rsa is to store our personal information, Never tell anyone about the Id_rsa;
Then we can add our SSH key to the Gitcafe;
Enter Gitcafe --- account Settings--SSH public Key Management settings, click The Add new public key button, enter any character in the Title text box, in the key text box paste the public key string you just copied, press the Save button to complete the operation.
After adding, we will test the connection to see if we can connect the Gitcafe;
In Git bash, enter:
ssh-t [email protected]
If this is the first connection, the following message will appear:
The authenticity of host ' gitcafe.com (50.116.2.223) ' can ' t be established. #RSA Key fingerprint is 84:9e:c9:8e:7f:36:28:08 : 7e:13:bf:43:12:74:11:4e. #Are you sure do want to continue connecting (yes/no)?
We check whether the above information is consistent with what we generated, and if we agree, we will enter Yes;
Then the middle will prompt us to enter the passphrse password;
Enter passphrase for key '/c/users/username/.ssh/id_rsa ':
The following prompt message appears when the connection is successful:
Hi username! You ' ve successfully authenticated, but Gitcafe does not provide shell access.
the user name is our Gitcafe user name.
This is the first time we have used ssh, like I started using an account to build my blog, then I have a key on GitHub, and then I signed up for an account to build a page; The key that I used when I started my work was always chaotic; yesterday I found a not very good solution; or solved the problem;
The first step is to generate another key:
Ssh-keygen-t rsa-c "[email protected]"-F ~/.ssh/gitcafe
The steps here are basically the same as in the front;
The second step and the second step ahead, I will not repeat;
The third step here is a key step: in the SSH User configuration file ~/.ssh/config
Specify the name of the public key used in the corresponding service, and if there is no config file, create a new one and enter the following:
Host gitcafe.com www.gitcafe.com identityfile ~/.ssh/gitcafe
The name in the
back is the name of your key, and the key I created on GitHub, which I've added in this way, just changed the URL to GitHub;
There's another problem back here, because I have two accounts, my Gitcafe key is two, so, I added two keys in the inside, the first key is the key I am currently using, when we need to put which in the first place, although a little trouble, but still can exist two together ; (There may be a better way here, and I hope you have a better way to tell me.)
The next steps are the same as the previous one, adding to the Gitcafe and testing the connection;
We can connect after Gitcafe, this we can build our page, can also build a blog system, I build the blog system is hexo (static page blog);
Here we need to use our Git tools, first we create a public project on the Gitcafe (because we use free hosting, private projects to spend money), we can start to fill out the project name, the project name and our user name, so that we can use the level two domain name After filling in the front, the project homepage should automatically generate our level two domain name;
Then we click Done and some code should appear below:
1 Global settings: git config--global user.name ' git config--global user.email ' your mailbox ' 2 Next:? Create a new git repository locally mkdir 1cd 1git inittouch readme.mdgit add readme.mdgit commit-m ' first commit ' Git remote add origin ' [email Protected]: Your project address ' Git push-u origin master or? ' A local git repository cd existing_git_repogit Remote add origin ' [email protected]: Project address ' Git push-u origin master
then we can directly gitcafe inside to add the file, you can also create a new folder in the machine and then submit to the Gitcafe, you can also put an existing folder, Git init and then put this folder to Gitcafe, according to the above code on the line;
Here is the first time to commit the code, the subsequent commit update can not add-u, which can be used to learn git;
Then here we default to Git to create the master branch, and we gitcafe above can show the page is Gitcafe-pages branch, first we can create a new branch:
Git checkout-b gitcafe-pages
The
rest of the code can be the same, so that what we commit will be generated in the Gitcafe-pages branch, which is a little different from the front when we submit it .
Git remote add origin ' [email protected]: Project address ' Git push-u origin gitcafe-pages
Because we are going to commit to this branch of gitcafe-pages, we need to change the master branch to the Gitcafe-pages branch, then we can submit our page code, mainly HTML, which can contain CSS and JS; will not immediately be able to display on the level two domain name, wait for a while, there is, the HTML file name is best called index.html, I started yesterday is not the name, after the submission is not shown, after the change, it can be displayed. Then we can customize our page, and do a small porter, I wish you all toss happy ~ ~