git——新舊項目push到遠程倉庫

新創建了一個遠程倉庫,如何將已有的代碼推上去呢?

或者如何本地新建一個倉庫呢?

所有情況如下所示:

 

Git global setup

git config --global user.name "你的名字"
git config --global user.email "你的郵箱"

Create a new repository

git clone ssh://路徑.git
cd 遠程倉庫名
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

Push an existing folder

cd existing_folder
git init
git remote add origin ssh://路徑.git
git add .
git commit -m "Initial commit"
git push -u origin master

Push an existing Git repository

cd existing_repo
git remote rename origin old-origin
git remote add origin ssh://路徑.git
git push -u origin --all
git push -u origin --tags

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章