請(qǐng)問怎么實(shí)現(xiàn)代碼托管呢
-我在GitHub上新建了一個(gè)公有倉庫,沒有README.md;本地有一個(gè)已經(jīng)初始化過的git倉庫,是我需要托管的代碼;
將本地的代碼傳到遠(yuǎn)程庫的過程遇到了一些問題:
-git remote add origin [url]
...省略提交到本地
-git push origin master
根據(jù)提示我先git pull origin master再push,還是這個(gè)錯(cuò)誤
沒法我只好-f強(qiáng)制push了,但是我知道這個(gè)方法不可取,不知道有沒有靠譜點(diǎn)的方法。
先謝指教!
2019-05-30
如果在github上去建項(xiàng)目,可以建一個(gè)空的項(xiàng)目。
然后在本地已經(jīng)有代碼的目錄,使用如下命令:
初始化 => 添加遠(yuǎn)程倉庫地址??=> 添加本地已有文件?=> 添加提交注釋?=> 推送
git init
git remote add origin [url]
git add .
git commit -m "first commit"
git push origin master
謝謝您的關(guān)注
2019-05-30
gitee.com