Git 全局設(shè)置:
git config –global user.name “wkable” git config –global user.email “kun0119870924@126.com”
創(chuàng)建 git 倉(cāng)庫(kù):
mkdir Joopic cd Joopic git init【注釋:初始化git】 touch README.md git add README.md【在commit之前要將要提交的文件通過(guò)add添加到git管理中】 git commit -m “first commit” git remote add origin https://git.oschina.net/wkable/Joopic.git git push -u origin master
已有項(xiàng)目?
cd existing_git_repo git remote add origin https://git.oschina.net/wkable/Joopic.git git push -u origin master
如果push后出現(xiàn)了“更新被拒絕,因?yàn)槟?dāng)前分支的最新提交落后于其對(duì)應(yīng)的遠(yuǎn)程分支。”的提示,則使用 git fetch origin git merge origin/master
免密碼登陸: ssh登陸: 使用ssh-keygen -t rsa -f id_rsa_oschina【-t用來(lái)選擇加密方式rsa/dsa兩種可選,-f用來(lái)設(shè)置生成的公鑰私鑰的文件名】來(lái)創(chuàng)建公鑰私鑰,生成的公鑰私鑰會(huì)默認(rèn)保存在你執(zhí)行上述ssh命令的目錄下,其中公鑰以.pub結(jié)尾,私鑰則沒(méi)有后綴名。使用cat 命令可以查看公鑰私鑰,將私鑰文件保存在/home/username/.ssh文件夾下,我使用的時(shí)mv命令mv id_rsa_oschina ./.ssh然后將公鑰內(nèi)容復(fù)制后保存到oschina的服務(wù)器上,就可以不必輸入用戶名密碼直接登陸。若想要測(cè)試ssh是否配置成功,可以使用ssh -T git@oschina.net命令。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注