Github 十分钟上手 (10 minutes Github config)

来源:互联网 发布:如何用艾瑞查数据 编辑:程序博客网 时间:2024/06/08 11:35

1. Create a account in https://github.com/ and create a new repository by clicking "Create a new project"

2. Apt install github in ubuntu, actually you can use different ways in different OS, quite easy.

3. Now you have to config ssh, hopefully installed already, otherwise install it. Check with this:

mickey@ubuntu:~$ ssh
usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file] [-L address]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
           [-Q query_option] [-R address] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]

4. Now we need to get our key with rsa, which is an encryption algorithm.

mickey@ubuntu:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/mickey/.ssh/id_rsa): 
Created directory '/home/mickey/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/mickey/.ssh/id_rsa.
Your public key has been saved in /home/mickey/.ssh/id_rsa.pub.
The key fingerprint is:
SHAsdfsspEdfdfNsdf6t98+LOIF/Gfu1yM mickey@ubuntu
The key's randomart image is:
+---[RSA 2048]----+
| o.+o+ .         |
|+.+o= = o        |
|++o..O +         |
|o+...oOo         |
| .o  .+oS        |
|    ...=         |SSH and GPG keys
|     .o.o.o  .   |
|      o..=o E o  |
|     ..o.+=o . . |
+----[SHA256]-----+
mickey@ubuntu
:~$ cd ~/.ssh
mickey@ubuntu
:~/.ssh$ cat id_rsa.pub

5.  Now copy paste the output(your public key contents) to the page github.com -> settings -> SSH and GPG keys -> New SSH key (name is not important, leave it empty, copy to the content)

6. cd to your target place like "mkdir github"

mickey@ubuntu:~/github$ git init
Initialized empty Git repository in /home/mickey/github/.git/

mickey@ubuntu:~/github$ git add -A

mickey@ubuntu:~/github$ git remote add origin https://github.com/xxxxxx/xxx.git
mickey@ubuntu:~/github$ git commit -m “test”

On branch master
Initial commit
nothing to commit


(1. You may need to config the email and name according to the printed out instruction.)
(2.The git file address can be found in page "Clone and download")

mickey@ubuntu:~/github$ git pull --rebase origin master
mickey@ubuntu:~/github$ git push -u origin master


(If you want to remove file note to use "git rm" instead of "rm")
("-u" just use when you first push something)
("pull" is to get from github, "push" is upload)

Now you get it!
GL.
0 0