欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

新建Github倉庫并上傳本地代碼

按照Github的教程 Adding a local repository to GitHub using Git

創(chuàng)新互聯(lián)建站公司2013年成立,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項目成都網(wǎng)站制作、成都網(wǎng)站設(shè)計網(wǎng)站策劃,項目實施與項目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元沙雅做網(wǎng)站,已為上家服務(wù),為沙雅各地企業(yè)和個人服務(wù),聯(lián)系電話:18982081108

1. 創(chuàng)建空的Github倉庫

創(chuàng)建遠程倉庫 ???? ,注意不要勾選,如果勾選會生成一筆提交,如果本地倉庫也提交了代碼,會導(dǎo)致拉取/推送代碼失敗。

2. 切換到本地環(huán)境,初始化倉庫

$ git init -b main

3. 添加本地文件并提交

$ git add .
# Adds the files in the local repository and stages them for commit. 若要取消暫存文件,請使用“git reset HEAD YOUR-FILE”。
$ git commit -m "First commit"
# Commits the tracked changes and prepares them to be pushed to a remote repository. 要刪除此提交并修改文件,請使用 'git reset --soft HEAD~1' 并再次提交和添加文件。

4. 關(guān)聯(lián)本地倉庫和遠程倉庫

$ git remote add origin  <REMOTE_URL> 
# Sets the new remote
$ git remote -v
# Verifies the new remote URL

5. 推送代碼到遠程倉庫

$ git push -u origin main
# Pushes the changes in your local repository up to the remote repository you specified as the origin

如果勾選了 ,執(zhí)行最后一步,推送本地代碼到遠程倉庫時會報錯

error: failed to push some refs to 'github.com:bwz1984/sql2code.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

因此嘗試?yán)∵h程代碼

$ git pull origin main

終端提示如下

hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint: 
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: refusing to merge unrelated histories

重點在于最后一句,Git提示fatal: refusing to merge unrelated histories,原因分析如下

You have a new Git repository with some commits. You then try to pull from an existing remote repo. The merge becomes incompatible because the histories for branch and remote pull are different. Git sees the situation as you trying to merge two completely unrelated branches, and it doesn’t know what to do.

解決方案

$ git pull origin main --allow-unrelated-histories
$ git push origin main

網(wǎng)站題目:新建Github倉庫并上傳本地代碼
URL網(wǎng)址:http://chinadenli.net/article0/dsoicio.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗、軟件開發(fā)、微信小程序、定制開發(fā)、做網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

微信小程序開發(fā)