1. 程式人生 > >github帳號申請和使用教程

github帳號申請和使用教程

github帳號申請和使用教程

1、打開github官網進行註冊(有可能會少一兩張截圖),如下圖:

技術分享圖片


技術分享圖片

技術分享圖片

技術分享圖片


2、新建項目,如下圖:

技術分享圖片

技術分享圖片



3、創建完成後,簡單使用說明,如下圖:

技術分享圖片


4、在客戶端上執行如下命令,將生產的公鑰信息粘貼到github SSH key中,並測試能否連接成功。如下圖:

[root@PXC01 ~] ssh-keygen -t rsa -C "[email protected]"

[root@PXC01 ~] cat /root/.ssh/id_rsa.pub

[root@PXC01 ~] ssh -T [email protected]
The authenticity of host 'github.com (13.229.188.59)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,13.229.188.59' (RSA) to the list of known hosts.
Hi net881004! You've successfully authenticated, but GitHub does not provide shell access.

技術分享圖片


5、git使用步驟

[root@PXC01 ~]# git config --global user.name "gxm"

[root@PXC01 ~]# git config --global user.email "[email protected]"

[root@PXC01 ~]# mkdir gxmscript

[root@PXC01 ~]# cd gxmscript

[root@PXC01 gxmscript]# echo "# sailikung" >> README.md

[root@PXC01 gxmscript]# git init

[root@PXC01 gxmscript]# git add README.md

[root@PXC01 gxmscript]# git commit -m "first commit"

[root@PXC01 gxmscript]# git remote add origin [email protected]:net881004/sailikung.git

[root@PXC01 gxmscript]# git push -u origin master
Warning: Permanently added the RSA host key for IP address '52.74.223.119' to the list of known hosts.
Counting objects: 3, done.
Writing objects: 100% (3/3), 213 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To [email protected]:net881004/sailikung.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

[root@PXC01 gxmscript]# git pull origin master
[root@PXC01 gxmscript]# git pull origin master
From github.com:net881004/sailikung
 * branch            master     -> FETCH_HEAD
Already up-to-date.

[root@PXC01 gxmscript]# 新建文件(我rz上傳了我之前寫的一些腳本)

[root@PXC01 gxmscript]# git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       bak_log.sh
#       check_os.sh
#       check_pid_autostart.sh
#       dspam_install.sh
#       fail2b_install.sh
#       for-inbox_to-other.sh
#       heartbeat_drbd_monitor.sh
#       imapmail.sh
#       mysql_manage.sh
#       mysqlclear_dirtydata.sh
#       restoremail.sh
#       samba_install.sh
#       search_restore_maildata.sh
#       service_montir.sh
#       win_to_lin_maildata.sh
nothing added to commit but untracked files present (use "git add" to track)

[root@PXC01 gxmscript]# git add *

[root@PXC01 gxmscript]# git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       new file:   bak_log.sh
#       new file:   check_os.sh
#       new file:   check_pid_autostart.sh
#       new file:   dspam_install.sh
#       new file:   fail2b_install.sh
#       new file:   for-inbox_to-other.sh
#       new file:   heartbeat_drbd_monitor.sh
#       new file:   imapmail.sh
#       new file:   mysql_manage.sh
#       new file:   mysqlclear_dirtydata.sh
#       new file:   restoremail.sh
#       new file:   samba_install.sh
#       new file:   search_restore_maildata.sh
#       new file:   service_montir.sh
#       new file:   win_to_lin_maildata.sh
#

[root@PXC01 gxmscript]# git commit -m "upload sh"   
[master f68abfd] upload sh
 15 files changed, 1784 insertions(+), 0 deletions(-)
 create mode 100644 bak_log.sh
 create mode 100644 check_os.sh
 create mode 100644 check_pid_autostart.sh
 create mode 100644 dspam_install.sh
 create mode 100644 fail2b_install.sh
 create mode 100644 for-inbox_to-other.sh
 create mode 100644 heartbeat_drbd_monitor.sh
 create mode 100644 imapmail.sh
 create mode 100644 mysql_manage.sh
 create mode 100644 mysqlclear_dirtydata.sh
 create mode 100644 restoremail.sh
 create mode 100644 samba_install.sh
 create mode 100644 search_restore_maildata.sh
 create mode 100644 service_montir.sh
 create mode 100644 win_to_lin_maildata.sh

[root@PXC01 gxmscript]# git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)

[root@PXC01 gxmscript]# git log
commit f68abfdaec8b6130380f15c2ed82eb36866dde24
Author: gxm <[email protected]>
Date:   Sun May 20 22:49:26 2018 +0800
    upload sh
commit 80757952c28478f575f89551ff6208d3cbd9741b
Author: gxm <[email protected]>
Date:   Sun May 20 22:40:54 2018 +0800
    first commit

[root@PXC01 gxmscript]# git push origin master
Counting objects: 18, done.
Compressing objects: 100% (17/17), done.
Writing objects: 100% (17/17), 15.68 KiB, done.
Total 17 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
To [email protected]:net881004/sailikung.git
   8075795..f68abfd  master -> master


github帳號申請和使用教程