今天,需要再本地使用git管理代碼,但是當代碼創建好的時候,想發布到github上面的私有倉庫中,但是沒有提前創建遠端倉庫,所以需要把本地git倉庫推送到遠端另外一個倉庫了,下面進行簡要記錄,剛剛經過的程序,方便之后再次使用的時候,不會重復勞動:
- git 設定 git config user.name user.email
- 添加 github 遠程 公鑰
- git init . 創建本地倉庫
- 創建檔案并使用 git add . 進行檔案提交
- git commit -sam ""
- 創建 github.com private repo
- git remote add origin [email protected]:repossh鏈接
- git remote show origin 查看遠端倉庫是否添加成功
- git push --set-upstream origin master
- git branch --set-upstream-to=origin/master master
- git pull 和遠程倉庫進行合并
- git config --global push.default simple 設定push default 默認約定
- Since Git 2.0, Git defaults to the more conservative 'simple' behavior, which only pushes the current branch to the corresponding remote branch that 'git pull' uses to update the current branch.
- git push
- git status
- git pull 這個時候 你就會發現 遠程倉庫已經同步成功;整個推送操作成功;
保持更新,更多內容請關注 cnblogs.com/xuyaowen;
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/161984.html
標籤:Linux
下一篇:git 取消檔案跟蹤
