VS Code x GitLab 首次註冊使用教學 如何從 VSCODE 上傳到 gitLab

第一次使用 VSCode @@
總之一定要來搭配 Git 於 GitLab 上使用


  1. 先於 GitLab 上新增 New Project

  2. 新增完後,GitLab 會提醒需要 ssh 連線才能 push & pull
    https://gitlab.com/help/ssh/README (Teach how to generate a new key or locating a existing key)
  3. 下載 puttygen,產生一組 public & private key
  4. 在 GitLab 上傳 public key
    https://gitlab.com/profile/keys
  5. 接下來就回到 VS Code,按 Ctrl + ` ,把 Integrated Terminal 打開
  6. 輸入 public key 的檔案

    cat ~/.ssh/id_rsa.pub

  7. 進入到要 git 的資料夾
    cd newFolder
  8. 輸入一些 git 指令

    // 設定 git 資訊
    git config --global user.name "Your Name"
    git config --global user.email "Your Email"
    
    // 初始化 a new repository
    git init
    
    // 把 gitLab 上的同步過來
    // 這邊會要求輸入 gitLab 的帳號密碼,就是登入時用的
    git remote add origin git@gitlab.com:YOURNAME/YOURNAME.git
    
    // 把該資料檔案全部加入 git staging area (要同步的檔案) 準備 commit
    git add .
    //git add -A 也可
    
    // 新增一個 commit
    git commit -m "版本備註"
    
    // 上傳到 gitLab
    // master 是主線的意思
    git push -u origin master
    
    
  9. 回到 gitLab 查看一下東西有沒有上傳,這時應該 VSCODE 也會有對應的 git 狀態了



Comments

Popular posts from this blog

在SugarCRM環境中 install 安裝 KnowledgeTree

Sitemap v.s. Webmaster Tools