- 在線上代碼倉庫創(chuàng)建一個(gè)遠(yuǎn)程倉庫,想把本地代碼上傳,然而此過程中報(bào)錯(cuò)
failed to push some refs to git
經(jīng)查閱,是因?yàn)檫h(yuǎn)程倉庫里的readme文件不在本地,所以報(bào)錯(cuò),解決辦法:
[如何解決failed to push some refs to git] (https://jingyan.baidu.com/article/f3e34a12a25bc8f5ea65354a.html)
git pull --rebase origin master //拉取并合并代碼
- git進(jìn)入配置文件:
vi .git/config
退出編輯模式 :
esc -> :wq
- 使用git將本地項(xiàng)目推送到gitlab的一般步驟:
在項(xiàng)目根目錄下:
git init //創(chuàng)建本地代碼倉庫
git add . //將根目錄內(nèi)的所有代碼加入到代碼倉庫
git commit -m "message" //將代碼提交到本地倉庫
git remote add origin http://username:pwd@gitlab.hua.com/username/project.git //添加遠(yuǎn)程庫 地址為: http://gitlab.hua.com/username/project.git
git push -u origin master