1. 程式人生 > >Git與遠程倉庫關聯以及關聯錯誤解決方法

Git與遠程倉庫關聯以及關聯錯誤解決方法

class 創建 rap 技術 get 假設 nta att width

假設你github的用戶名是 helloworld ,你在上面創建了一個 名為 hello 的 repository.

一. 與本地倉庫進行關聯

1.1用原生ssh進行關聯,速度快:

git remote add origin [email protected]/helloworld/hello.git
技術分享圖片

1.2用https進行關聯,速度相對ssh慢點:

git remote add origin https://github.com/helloworld/hello.git
技術分享圖片

二.如果不小心關聯錯了,則需要刪除這份關聯,再去關聯新的

2.1輸出 .git

rm -rf .git
技術分享圖片

2.2 再次建立git倉庫,並初始化

git init
技術分享圖片

2.3 再次添加並提交

git add 文件
git commit -m " "
技術分享圖片

然後再進行關聯就可以了。

Git與遠程倉庫關聯以及關聯錯誤解決方法