Github浣跨敤璁板綍

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Github浣跨敤璁板綍相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/email' title='email'>email   鍥剧墖   鏌ョ湅   鐢ㄦ埛   remote   http   strong   娌′簨   git merge   

Github浣跨敤璁板綍

閰嶇疆Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"

鏀逛负鑷繁鐨刵ame鍜屽湴鍧€锛岀户缁洖杞︼紝榛樿璺緞鍜屽瘑鐮侊紝缁х画鍥炶溅锛岀敓鎴?ssh,鎵撳紑id_rsa.pub锛屽鍒秌ey鍒癵ithub鐨剆etting涓€?/p>

$ ssh -T git@github.com

楠岃瘉鏄惁杩炰笂github锛屾樉绀篩ou鈥榲e successfully authenticated, but GitHub does not provide shell access

$ git config --global user.name "your name"
$ git config --global user.email "your_email@youremail.com"

棣栨浣跨敤闇€瑕侀厤缃敤鎴峰悕瀵嗙爜锛?/p>

$ git remote add origin git@github.com:yourName/yourRepo.git

閰嶇疆杩滅▼鍦板潃锛屽皢鏈湴浠撳簱涓庤繙绋嬪簱鍏宠仈銆傛敼涓鸿嚜宸辩殑name鍜屽湴鍧€锛寉ourRepo.git鏄垰鎵嶈繙绋嬪垱寤虹殑浠撳簱

鏌ョ湅宸叉湁鐨勮繙绋嬪簱

git remote
git remote -v 锛堣缁嗕俊鎭級

1. 鍒涘缓涓€涓増鏈簱

$ mkdir Testgit
$ cd Testgit
$ pwd  鏄剧ず褰撳墠鐩綍

3.鎶婁竴涓枃浠跺悓姝ュ埌杩滅▼git浠撳簱

  • 绗竴姝ワ紝娣诲姞鏂囦欢
$ git add readme.txt/*
  • 绗簩姝ワ紝鎻愪氦鏀瑰姩鍒颁粨搴?/li>
git commit -m "浠g爜鎻愪氦淇℃伅"

鍒拌繖閲屾槸鏈湴鎻愪氦

  • 绗笁姝ワ紝鎻愪氦鍒拌繙绋嬪簱
git push origin master

origin鏄厤缃椂鍐欑殑杩滅▼搴撳悕

鐜板湪杩滅▼github灏辫窡鏈湴鍚屾浜嗐€?/p>

4. 灏嗚繙绋嬪唴瀹规洿鏂板埌鏈湴

git pull
鎴?git pull origin master

5. 浠庤繙绋嬪厠闅嗛」鐩埌鏈湴

git clone ssh鍊?https鍦板潃

6. 浣跨敤鍒嗘敮

鍒涘缓骞跺垏鎹㈠垎鏀痙ev

git checkout -b dev
#git checkout dev琛ㄧず浠呭垏鎹㈠垎鏀?
#git branch 鏌ョ湅鍒嗘敮

鍦ㄨ鍒嗘敮涓嬩慨鏀硅椤圭洰鐨勪换鎰忔枃浠?/p>

灏嗗垎鏀笂鐨勪慨鏀规彁浜ゅ埌鏈湴,濡傛灉涓峱ush鍗冲鍏朵粬浜轰笉鍙

git add *
git commit -m "淇敼鏁版嵁搴撹繛鎺?

鍒囨崲鍥炰富鍒嗘敮master

git checkout master

灏哾ev鍒嗘敮淇敼鍐呭鎺ㄩ€佸埌杩滅▼搴?/p>

git push origin dev

鏈€鍚庡悎骞跺垎鏀笌master锛屽彲鑳藉瓨鍦ㄥ啿绐?/p>

git merge dev

鎺ㄩ€佸埌杩滅▼master

git push origin master  

鎶ラ敊璁板綍

error: failed to push some refs to 鈥榞it@github.com:鈥?/p>

杩欐槸涓€涓枃浠跺啿绐佺殑閿欒

杩愯

 git pull --rebase origin master

鏈夋姤閿欙細

error: Failed to merge in the changes.
hint: Use 鈥榞it am --show-current-patch鈥?to see the failed patch`

git add *
git rebase --continue
git pull --rebase testgitorigin master
git push testgitorigin master

姝ゆ椂灏卞皢鏈湴鍚屾鍒拌繙绋嬨€?/p>

  • 鍏嬮殕椤圭洰鏃跺嚭閿?/li>

鎶€鏈浘鐗? alt=

logon failed

瑙e喅锛氶」鐩槸private锛屽洜涓烘病鏈夋椤圭洰鐨勬潈闄?/p>

以上是关于Github浣跨敤璁板綍的主要内容,如果未能解决你的问题,请参考以下文章

涓€娆惧彲瑙嗗寲娴忚鍣ㄥ巻鍙茬殑 Firefox/Chrome 鎻掍欢

淇濇姢鍔熻兘璁板綍

Oracle寤鸿〃鑴氭湰璁板綍

JAVA鍏ラ棬濉潙璁板綍

璁板綍 瀹岀編瑙g爜 閰嶇疆

[leetcode] 棰樿В璁板綍 11-20