在 gitlab 上新建了一個工程后,添加了 README 作為第一次提交。在本地目標(biāo)文件夾下執(zhí)行:

git init; git clone <工程url> 后將工程 commit 到本地,準備 push 時候發(fā)生了
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.
錯誤。原因是準備推送的地址和原來的地址不一致(我也不知道為啥)。
解決方法:
vim .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = git@gitlab.xxx:xxx/xxx.git <此處是你的工程鏈接地址>
fetch = +refs/heads/*:refs/remotes/origin/*
pushurl = git@gitlab.xxx:xxx/xxx.git <此處是你的工程鏈接地址>
[branch "master"]
remote = origin
merge = refs/heads/master
再執(zhí)行g(shù)it pull --allow-unrelated-histories
就可以push了
當(dāng)前名稱:git初始化-創(chuàng)新互聯(lián)
瀏覽路徑:http://www.chinadenli.net/article30/dccoso.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、面包屑導(dǎo)航、品牌網(wǎng)站設(shè)計、App開發(fā)、網(wǎng)站導(dǎo)航、網(wǎng)站建設(shè)
聲明:本網(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)
猜你還喜歡下面的內(nèi)容