连接 github 相关

  1. Failed to connect to github.com port 443 解决方案
    参考:https://zhuanlan.zhihu.com/p/670646102
  2. 多个账号切换
    参考:https://worktile.com/kb/ask/224209.html
  3. bash代码
1. **Remove the existing GitHub account from WebStorm:**
   - Go to `Preferences` > `Version Control` > `GitHub`.
   - Select the existing account and click the `-` button to remove it.

2. **Add multiple GitHub accounts:**
   - In the same `Preferences` > `Version Control` > `GitHub` section, click the `+` button.
   - Choose `Log In via GitHub` and follow the authentication steps to add each of your GitHub accounts.

3. **Configure SSH keys for each GitHub account:**
   - Generate a new SSH key for each GitHub account:
     ```sh
     ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
     ```
   - Add the SSH key to the corresponding GitHub account:
     ```sh
     ssh-add ~/.ssh/id_rsa
     ```
   - Copy the SSH key to your clipboard:
     ```sh
     pbcopy < ~/.ssh/id_rsa.pub
     ```
   - Add the SSH key to your GitHub account via GitHub's web interface.

4. **Create an SSH config file to manage multiple keys:**
   - Edit or create the `~/.ssh/config` file:
     ```sh
     touch ~/.ssh/config
     nano ~/.ssh/config
     ```
   - Add the following configuration for each GitHub account:
     ```sh
     Host github.com-ACCOUNT1
       HostName github.com
       User git
       IdentityFile ~/.ssh/id_rsa_account1

     Host github.com-ACCOUNT2
       HostName github.com
       User git
       IdentityFile ~/.ssh/id_rsa_account2
     ```

5. **Update the remote URL for your repositories:**
   - Open the terminal in WebStorm.
   - Use the following command to update the remote URL to use the correct SSH configuration:
     ```sh
     git remote set-url origin git@github.com-ACCOUNT1:USERNAME/REPOSITORY_NAME.git
     ```

6. **Verify the changes:**
   - Use the following command to verify the remote URL:
     ```sh
     git remote -v
     ```
  1. push/pull超时问题
    参考:https://www.cnblogs.com/spriteZzz/p/17227579.html

posted on 2024-08-06 08:50  朝朝暮Mu  阅读(14)  评论(0)    收藏  举报