git代碼管理流程和一些問題

第一步:建立git倉庫

cd到你的本地項(xiàng)目根目錄下,執(zhí)行g(shù)it命令,此命令會(huì)在當(dāng)前目錄下創(chuàng)建一個(gè).git文件夾。

git init

第二步:將項(xiàng)目的所有文件添加到倉庫中

git add .

這個(gè)命令會(huì)把當(dāng)前路徑下的所有文件添加到帶上傳的文件文件列表中。

如想添加某個(gè)特定的文件,只需要把 . 換成特定的文件名即可

第三步:將add的文件commit 到倉庫

git commit -m "注釋語句"

第四步:創(chuàng)建自己的Repository

第五步:將本地的倉庫關(guān)聯(lián)到GitHub上

git remote add origin https://自己的倉庫url地址

git remote -v 查看你當(dāng)前項(xiàng)目遠(yuǎn)程連接的是哪個(gè)倉庫地址

如果有錯(cuò)誤信息:fatal: remote origin already exists.

解決方法:

1、先輸入$ ? git remote rm origin?

2、再輸入$ git remote add origin https://自己的倉庫url地址

第六步:上傳代碼到github遠(yuǎn)程倉庫

git push -u origin master

一般上傳之前先拉取一下:

git pull origin master

如果出現(xiàn)以下錯(cuò)誤:

Permission denied (publickey).

fatal: The remote end hung up unexpectedly.


Permission denied (publickey).

fatal: Could not read from remote repository.

解決方法:

進(jìn)入~/.ssh下查看是否存在密鑰對id_rsa和id_rsa.pub,直接運(yùn)行heroku keys:add

如果不存在的話,生成一對

ssh-keygen -t rsa

再然后

heroku keys:add

檢查本地私鑰是否存在于ssh服務(wù)中

eval `ssh-agent -s`

如果出現(xiàn)Could not open a connection to your authentication agent,那么就先運(yùn)行

ssh-agent bash

接著:ssh-add -l

如果沒出錯(cuò),需要添加進(jìn)去

ssh-agent

ssh-add ~/.ssh/id_rsa

參考博客:


http://blog.csdn.net/beslow/article/details/33727917

git代碼上傳常見問題

如何上傳本地代碼到github上-xrw_coder

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容