1、先在遠程倉庫(如github)創建項目,為了避免錯誤,不要初始化 README, license, 或者gitignore文件 .
2、打開Terminal終端
3、切換到你的本地項目目錄
4、初始化本地倉庫
git init
5、添加文件到本地倉庫
git add .
6、提交文件
git commit -m "First commit"
7、到遠程倉庫的頁面上,復制倉庫地址 (筆者以配置好ssh,故復制ssh形式的倉庫地址)
8、添加遠程倉庫地址到本地倉庫
git remote add origin {遠程倉庫地址}
# Sets the new remote
git remote -v
# Verifies the new remote URL
9、push到遠程倉庫
git push -u origin master
# Pushes the changes in your local repository up to the remote repository you specified as the origin
————————————————
版權聲明:本文為CSDN博主「dujianxiong」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/dujianxiong/article/details/78991166