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

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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值