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