git remote add origin https://github.com/Ineedstrong/socket-practice.git如果不行的情況下
git remote set-url origin git@github.com:Ineedstrong/socket-practice.git
就以這種方式
3. 使用 SSH 替代 HTTPS(推薦)
繞過 HTTPS 的 TLS 問題:
生成 SSH 密鑰:
bash
ssh-keygen -t ed25519 -C "your_email@example.com" # 回車使用默認路徑
將公鑰添加到 GitHub:
復制公鑰內容:
bash
cat ~/.ssh/id_ed25519.pub
在 GitHub:?Settings → SSH and GPG keys → New SSH key?中粘貼。
將遠程 URL 改為 SSH:
bash
git remote set-url origin git@github.com:Ineedstrong/socket-practice.git
重新推送:
bash
git push -u origin main