git 现在本地创建仓库 再 推送到 远程 github 仓…

2019-10-17 08:59:32来源:博客园 阅读 ()

新老客户大回馈,云服务器低至5折

git 现在本地创建仓库 再 推送到 远程 github 仓库中

今天,需要再本地使用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 git@github.com: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.cnblogs.com/xuyaowen/p/local-git-repo-to-github.html
如有疑问请与原作者联系

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:shell 数组操作

下一篇:基于MQTT协议的云端proxy远程登陆