Skip to content

Instantly share code, notes, and snippets.

@k4zek4ge
Last active July 25, 2022 08:40
Show Gist options
  • Select an option

  • Save k4zek4ge/3b54d0cfe06068f7736e3ae43a87df12 to your computer and use it in GitHub Desktop.

Select an option

Save k4zek4ge/3b54d0cfe06068f7736e3ae43a87df12 to your computer and use it in GitHub Desktop.

Revisions

  1. k4zek4ge revised this gist Jul 25, 2022. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions multiplegit.sh
    Original file line number Diff line number Diff line change
    @@ -84,6 +84,9 @@ git remote add origin [email protected]_user1:work_user1/repo_name.git
    git remote add origin git@github_mdcdev:mdcdev/mdc_sid_web.git
    #Ensure the string between @ and : matches the Host we have given in the SSH config.

    #to remove origin
    git remote remove origin

    #VSCode:
    command-shif-p
    git@github_k4zek4ge:k4zek4ge/insta.git
  2. k4zek4ge revised this gist Jun 4, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions multiplegit.sh
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,7 @@
    - git init
    - git remote add origin git@github_apitep:mdcdev/myapp.git
    - git remote add origin [email protected]:eric.nahon/toolbox_empowerdatatransfer.git
    - git remote set-url origin git@github_ericnahon:ericnahon/geography.git
    - commit & push from VScode


  3. k4zek4ge revised this gist Mar 14, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions multiplegit.sh
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@
    - flutter create --org net.apitep .
    - git init
    - git remote add origin git@github_apitep:mdcdev/myapp.git
    - git remote add origin [email protected]:eric.nahon/toolbox_empowerdatatransfer.git
    - commit & push from VScode


  4. k4zek4ge revised this gist Dec 25, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions multiplegit.sh
    Original file line number Diff line number Diff line change
    @@ -70,6 +70,7 @@ git remote -v
    #Check whether the URL matches our GitHub host to be used, or else update the remote origin URL.
    git remote set-url origin [email protected]_user1:worker_user1/repo_name.git
    git remote set-url origin git@github_mdcdev:mdcdev/mdcusers.git
    git remote set-url origin git@github_ericnahon:ericnahon/mdcusers.git
    #Ensure the string between @ and : matches the Host we have given in the SSH config.

    #
  5. k4zek4ge revised this gist Nov 1, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion multiplegit.sh
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    - create a new 'myapp' repo on github without any commit
    - create a folder 'myapp' on local
    - drop folder on VScode
    - flutter create --org net.apitep myapp
    - flutter create --org net.apitep .
    - git init
    - git remote add origin git@github_apitep:mdcdev/myapp.git
    - commit & push from VScode
  6. k4zek4ge revised this gist Aug 9, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions multiplegit.sh
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@
    - create a new 'myapp' repo on github without any commit
    - create a folder 'myapp' on local
    - drop folder on VScode
    - flutter create .
    - flutter create --org net.apitep myapp
    - git init
    - git remote add origin git@github_mdcdev:mdcdev/myapp.git
    - git remote add origin git@github_apitep:mdcdev/myapp.git
    - commit & push from VScode


  7. k4zek4ge revised this gist Aug 9, 2021. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions multiplegit.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,13 @@
    #classic workflow
    - create a new 'myapp' repo on github without any commit
    - create a folder 'myapp' on local
    - drop folder on VScode
    - flutter create .
    - git init
    - git remote add origin git@github_mdcdev:mdcdev/myapp.git
    - commit & push from VScode


    ls -al ~/.ssh

    #
  8. k4zek4ge revised this gist Jun 11, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions multiplegit.sh
    Original file line number Diff line number Diff line change
    @@ -59,6 +59,7 @@ git remote -v

    #Check whether the URL matches our GitHub host to be used, or else update the remote origin URL.
    git remote set-url origin [email protected]_user1:worker_user1/repo_name.git
    git remote set-url origin git@github_mdcdev:mdcdev/mdcusers.git
    #Ensure the string between @ and : matches the Host we have given in the SSH config.

    #
  9. k4zek4ge revised this gist Feb 12, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions multiplegit.sh
    Original file line number Diff line number Diff line change
    @@ -73,6 +73,7 @@ git remote add origin git@github_mdcdev:mdcdev/mdc_sid_web.git
    #VSCode:
    command-shif-p
    git@github_k4zek4ge:k4zek4ge/insta.git
    git@github_mdcdev:mdcdev/insta.git

    #Push the initial commit to the GitHub repository:
    git add .
  10. k4zek4ge revised this gist Feb 5, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion multiplegit.sh
    Original file line number Diff line number Diff line change
    @@ -67,7 +67,7 @@ git init

    #Create the new repository in the GitHub account and then add it as the Git remote to the local repository.
    git remote add origin [email protected]_user1:work_user1/repo_name.git
    git remote set-url origin git@github_mdcdev:mdcdev/mdc_sid_web.git
    git remote add origin git@github_mdcdev:mdcdev/mdc_sid_web.git
    #Ensure the string between @ and : matches the Host we have given in the SSH config.

    #VSCode:
  11. k4zek4ge revised this gist Feb 4, 2021. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions multiplegit.sh
    Original file line number Diff line number Diff line change
    @@ -22,6 +22,9 @@ pbcopy < ~/.ssh/id_rsa.pub
    #
    ssh-add ~/.ssh/id_rsa_work_user1

    #in case ssh agent is not open
    exec ssh-agent bash

    #---------------------------------------------------------------------
    #Creating the SSH config File
    #---------------------------------------------------------------------
  12. k4zek4ge revised this gist Jan 18, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions multiplegit.sh
    Original file line number Diff line number Diff line change
    @@ -64,6 +64,7 @@ git init

    #Create the new repository in the GitHub account and then add it as the Git remote to the local repository.
    git remote add origin [email protected]_user1:work_user1/repo_name.git
    git remote set-url origin git@github_mdcdev:mdcdev/mdc_sid_web.git
    #Ensure the string between @ and : matches the Host we have given in the SSH config.

    #VSCode:
  13. k4zek4ge renamed this gist Dec 6, 2020. 1 changed file with 17 additions and 24 deletions.
    41 changes: 17 additions & 24 deletions multiplegit.txt → multiplegit.sh
    Original file line number Diff line number Diff line change
    @@ -8,8 +8,9 @@ ssh-keygen -t rsa -C "email@work_mail.com" -f "id_rsa_work_user1"
    #
    #Adding the new SSH key to the corresponding GitHub account
    #

    Copy the public key pbcopy < ~/.ssh/id_rsa.pub and then log in to your personal GitHub account:
    #Copy the public key
    pbcopy < ~/.ssh/id_rsa.pub
    #and then log in to your personal GitHub account:

    1 Go to Settings
    2 Select SSH and GPG keys from the menu to the left.
    @@ -19,13 +20,11 @@ Copy the public key pbcopy < ~/.ssh/id_rsa.pub and then log in to your personal
    #
    #Registering the new SSH Keys with the ssh-agent
    #

    ssh-add ~/.ssh/id_rsa_work_user1

    #
    #---------------------------------------------------------------------
    #Creating the SSH config File
    #

    #---------------------------------------------------------------------
    cd ~/.ssh/
    touch config // Creates the file if not exists
    code config // Opens the file in VS code, use any editor
    @@ -41,43 +40,37 @@ Host github.com-work_user1
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_rsa_work_user1


    #----------------------------------------------------------------------
    #
    #Clone repo
    #

    git clone [email protected]_user1:work_user1/repo_name.git


    #
    #For Locally Existing Repositories
    #
    If we have the repository already cloned:
    #If we have the repository already cloned:

    List the Git remote of the repository, git remote -v

    Check whether the URL matches our GitHub host to be used, or else update the remote origin URL.
    #List the Git remote of the repository:
    git remote -v

    #Check whether the URL matches our GitHub host to be used, or else update the remote origin URL.
    git remote set-url origin [email protected]_user1:worker_user1/repo_name.git
    Ensure the string between @ and : matches the Host we have given in the SSH config.
    #Ensure the string between @ and : matches the Host we have given in the SSH config.

    #
    #If you are creating a new repository on local:
    #git init
    Initialize Git in the project folder git init.

    Create the new repository in the GitHub account and then add it as the Git remote to the local repository.
    #If you are creating a new repository on local, initialize Git in the project folder:
    git init

    #Create the new repository in the GitHub account and then add it as the Git remote to the local repository.
    git remote add origin [email protected]_user1:work_user1/repo_name.git
    Ensure the string between @ and : matches the Host we have given in the SSH config.
    #Ensure the string between @ and : matches the Host we have given in the SSH config.

    VSCode:
    #VSCode:
    command-shif-p
    git@github_k4zek4ge:k4zek4ge/insta.git

    Push the initial commit to the GitHub repository:

    #Push the initial commit to the GitHub repository:
    git add .
    git commit -m "Initial commit"
    git push -u origin master
  14. k4zek4ge revised this gist Oct 4, 2020. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions multiplegit.txt
    Original file line number Diff line number Diff line change
    @@ -72,6 +72,10 @@ Create the new repository in the GitHub account and then add it as the Git remot
    git remote add origin [email protected]_user1:work_user1/repo_name.git
    Ensure the string between @ and : matches the Host we have given in the SSH config.

    VSCode:
    command-shif-p
    git@github_k4zek4ge:k4zek4ge/insta.git

    Push the initial commit to the GitHub repository:

    git add .
  15. k4zek4ge revised this gist Mar 9, 2020. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions multiplegit.txt
    Original file line number Diff line number Diff line change
    @@ -62,8 +62,9 @@ Check whether the URL matches our GitHub host to be used, or else update the rem
    git remote set-url origin [email protected]_user1:worker_user1/repo_name.git
    Ensure the string between @ and : matches the Host we have given in the SSH config.

    If you are creating a new repository on local:

    #
    #If you are creating a new repository on local:
    #git init
    Initialize Git in the project folder git init.

    Create the new repository in the GitHub account and then add it as the Git remote to the local repository.
  16. k4zek4ge revised this gist Jan 7, 2020. 1 changed file with 29 additions and 1 deletion.
    30 changes: 29 additions & 1 deletion multiplegit.txt
    Original file line number Diff line number Diff line change
    @@ -47,4 +47,32 @@ Host github.com-work_user1
    #Clone repo
    #

    git clone [email protected]_user1:work_user1/repo_name.git
    git clone [email protected]_user1:work_user1/repo_name.git


    #
    #For Locally Existing Repositories
    #
    If we have the repository already cloned:

    List the Git remote of the repository, git remote -v

    Check whether the URL matches our GitHub host to be used, or else update the remote origin URL.

    git remote set-url origin [email protected]_user1:worker_user1/repo_name.git
    Ensure the string between @ and : matches the Host we have given in the SSH config.

    If you are creating a new repository on local:

    Initialize Git in the project folder git init.

    Create the new repository in the GitHub account and then add it as the Git remote to the local repository.

    git remote add origin [email protected]_user1:work_user1/repo_name.git
    Ensure the string between @ and : matches the Host we have given in the SSH config.

    Push the initial commit to the GitHub repository:

    git add .
    git commit -m "Initial commit"
    git push -u origin master
  17. k4zek4ge created this gist Jan 7, 2020.
    50 changes: 50 additions & 0 deletions multiplegit.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    ls -al ~/.ssh

    #
    # generate ssh key
    #
    ssh-keygen -t rsa -C "email@work_mail.com" -f "id_rsa_work_user1"

    #
    #Adding the new SSH key to the corresponding GitHub account
    #

    Copy the public key pbcopy < ~/.ssh/id_rsa.pub and then log in to your personal GitHub account:

    1 Go to Settings
    2 Select SSH and GPG keys from the menu to the left.
    3 Click on New SSH key, provide a suitable title, and paste the key in the box below
    4 Click Add key — and you’re done!

    #
    #Registering the new SSH Keys with the ssh-agent
    #

    ssh-add ~/.ssh/id_rsa_work_user1

    #
    #Creating the SSH config File
    #

    cd ~/.ssh/
    touch config // Creates the file if not exists
    code config // Opens the file in VS code, use any editor

    # Personal account, - the default config
    Host github.com
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_rsa

    # Work account-1
    Host github.com-work_user1
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_rsa_work_user1


    #
    #Clone repo
    #

    git clone [email protected]_user1:work_user1/repo_name.git