如何使用 Git 对远程存储库进行初始推送? [英] How do I do an initial push to a remote repository with Git?

查看:17
本文介绍了如何使用 Git 对远程存储库进行初始推送?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了无数教程,但我一直在总结.这是我所拥有的:

I've read through countless tutorials and I keep coming up short. Here's what I've got:

  • 我在 Windows 桌面上运行 RubyMine
  • 我已经根据他们的 说明
  • Git 似乎在两台机器上都运行良好

这是我正在做的事情:

  1. 在服务器上:
    • mkdir 项目
    • git 初始化
    • git add .
    • git commit #==>没什么可提交的
  • 在 RubyMine 中创建新项目
  • Git init 在项目的顶层目录
  • 推送更改到服务器 #==>未能将一些引用推送到...
  • Create new project in RubyMine
  • Git init in top directory of project
  • Push changes to server #==> failed to push some refs to...

我遗漏了哪些步骤?

推荐答案

在服务器上:

mkdir my_project.git
cd my_project.git
git --bare init

在客户端:

mkdir my_project
cd my_project
touch .gitignore
git init
git add .
git commit -m "Initial commit"
git remote add origin youruser@yourserver.com:/path/to/my_project.git
git push origin master

请注意,当您添加源时,您可以使用多种格式和模式.我建议您看看您的托管服务提供了什么.

Note that when you add the origin, there are several formats and schemas you could use. I recommend you see what your hosting service provides.

这篇关于如何使用 Git 对远程存储库进行初始推送?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆