Skip to content

Project

chaolun edited this page Aug 18, 2020 · 3 revisions

Create a new repository

  • Set user name and email :

    $ git config --global user.name "chaolun"

    $ git config --global user.email "chaolun@yeah.net"

  • Create ssh key :

    $ ssh-keygen -t rsa -C "chaolun@yeah.net"

    If you don't need password continuous input enter 3 times

    Finally get 2 files : id_rsa and id_rsa.pub

  • Login Github and add ssh id_rsa.pub :

    Copy id_rsa.pub content to Settings -> SSH and GPG keys -> New SSH key

    Title can input an alias that is displayed on the GitHub by the SSH key

  • Test ssh whether successful :

    $ ssh -T git@github.com

    The authenticity of host 'github.com' (207.97.227.239) 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

    If you see your user name behind Hi. It mean success!

  • Modified .git/config file :

    Use git@github.com replace https://github.com

  • New github repository

    Sign in github and click the plus button next to the avatar in the upper right, Then select New Repository

New Unity Project

Open the Unity3d and create a new unity project

Use unity project path to create a repository with SourceTree

If you want to upload your project to github, click the plus button next to the avatar in the upper right, Then select Import Repository

In the Your old repository’s clone URL column fill in your project path and in the Your new repository details/Name column fill in your project name, Finally press Begin import button

Add Submodule

  • Create UnityFramework repository

  • $ git submodule add https://github.com/chaolunner/UnityFramework.git Assets/UnityFramework

Remove Submodule

Use UnityFramework for example

  • Open the .gitmodules file and delete the following

    [submodule "Assets/UnityFramework"]
      path = Assets/UnityFramework
      url = https://github.com/chaolunner/UnityFramework.git
    
  • Open the .git/modules/Assets folder and delete the UnityFramework folder

  • Open the .git/config file and delete the following

    [submodule "Assets/UnityFramework"]
      active = true
      url = https://github.com/chaolunner/UnityFramework.git
    
  • Commit and Push your changes

  • $ git rm --cached Assets/UnityFramework

  • $ rm -rf Assets/UnityFramework

Replacing SSH with HTTPS in Submodule

  • Edit .gitmodules file

    [submodule "Assets/UnityFramework"]
        path = Assets/UnityFramework
        url = https://github.com/chaolunner/UnityFramework.git
    [submodule "Assets/StreamingAssets"]
        path = Assets/StreamingAssets
        url = https://github.com/chaolunner/UnityFrameworkStreamingAssets.git
    
  • Open Terminal and Enter the following commands

    git submodule sync
    git submodule update --init
    

Clone this wiki locally