這篇文章主要介紹“如何推送代碼到碼云”,在日常操作中,相信很多人在如何推送代碼到碼云問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”如何推送代碼到碼云”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
git config --global user.name “用戶名”
git config --global user.email “郵箱”
2 生成公鑰私鑰
#ssh-keygen -t rsa -C "xxxxx@xxxxx.com"
一路Enter下去,將生成的公鑰填在碼云上
#cat ~/.ssh/id_rsa.pub
3建立git倉庫
在你的項目文件夾下執行git命令
git init
4 將項目文件添加到倉庫中
git add .
5 將add的文件commit到倉庫
git commit -m '備注'
6 將本地倉庫關聯到碼云上
git remote add origin git@gitee.com:shiqingqing/test.git
7 上傳碼云前要先pull 下
git pull origin master
8 最后一步 上傳代碼到碼云倉庫
git push -u origin master
執行完后到碼云看你項目的代碼
如出現錯誤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.
可執行此操作繼續,git push -u origin master -f 強制命令會覆蓋別人分支,慎用
到此,關于“如何推送代碼到碼云”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。