顯示具有 git 錯誤紀錄 標籤的文章。 顯示所有文章
顯示具有 git 錯誤紀錄 標籤的文章。 顯示所有文章

Git error: 解決在Gerrit網頁上submit patch set 出現衝突的情況

Cause:
在Gerrit等待code review通過期間,若有協同開發者先merge commit,且該commit和自己的commit
發生衝突的情況

Solution:

1.
在發生conflict 的 branch上 執行
git pull --rebase origin master
此指令說明如下
This command will fetch new commits from the remote and then rebase your local commits on top of them. It will temporarily set aside the changes you've made in your branch, apply all of the changes that have happend in master to your working branch, then merge (recommit) all of the changes you've made back into the branch. Doing this will help avoid future merge conflicts. Plus, it gives you an opportunity to test your changes against the latest code in master.
Once you are satisfied with your change set and you've rebased against master, you are ready to push your code to Gerrit for review.

簡單的說:把master上已合併的commit(但在目前branch不存在),接到目前的branch上,再把
目前branch的commit接到最後面(最新)
當然在Gerrit網頁上合併會發生衝突,所以執行這個指令之後在本地端也會發生衝突,把執行後的提示紀錄下來如下

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To check out the original branch and stop rebasing run "git rebase –abort".
第一行為當修改衝突後,要執行的指令

2.修改發生衝突的地方,使用vim修改
3.把修改後的檔案全部 git add
4.git add 所有的檔案之後執行 git rebase --continue
5.最後 git push origin HEAD:refs/for/master

6.必須重新等待code review

Git error: Permission denied (publickey). fatal: The remote end hung up unexpectedly


Permission denied (publickey).
fatal: The remote end hung up unexpectedly

原因:在本機端 git clone 專案時,使用指令時權限錯誤

解決:在輸入git clone 指令時切換到適合的權限,再輸入

或在放置專案的地方輸入 sshp-add

Git error: Permission denied (publickey) fatal: Could not read from remote repository

錯誤訊息:

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

問題原因:

通常是 SSH Key 沒有加入的問題

解決方式:
1.重新產生 SSH Key

終端機輸入
ssh-keygen –t rsa –b 2048

2.顯示 SSH Key

終端機輸入
cat ~/.ssh/id_rsa.pub    

3.貼到 Gerrit 中
Settings -> SSH Public Keys -> add key 
貼上第2步中所有的內容

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Affiliate Network Reviews