GitBash_在本地創建一個Git倉庫
Copyright Notice: This article is an original work licensed under the CC 4.0 BY-NC-ND license.
If you wish to repost this article, please include the original source link and this copyright notice.
Source link: https://v2know.com/article/1011
在GitBash中
cd /你的檔案目錄
git init
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/你的用戶名/your-repository-name.git
git push -u origin main
命令説明
git init
默認會產生一個叫master的主幹,我們可以在init的時候添加參數來讓第一個主幹叫main
git init --initial-branch=main
*(注意,--initial-branch是固定參數,不是名字+branch的組合)
也可以全局設置保證初始化的時候,生成的名爲main的主幹
git config --global init.defaultBranch main
當然,你也可以選擇修改分支:
git branch -m [目標分支] [更名后分支]
→下一篇:GitBash關於Remote的操作
→返回目錄:GitBash使用手冊
This article was last edited at 2024-07-06 20:12:58