需要一些基本的 github 帮助

发布于 2024-12-05 20:14:41 字数 989 浏览 2 评论 0原文

我正在尝试学习github来部署网页。以下是我正在采取的步骤:

git checkout master
git pull origin master
git checkout –b my-awesome-branch

做一些工作,执行 git status 来检查一切,一切都很好。

git add .
git commit –m "awesome message here"
git push origin my-awesome-branch
git checkout integration
git merge my-awesome-branch
git push origin integration
cap development deploy

这会将文件推送到我们拥有的开发服务器,以便人们可以查看它 - 这对我来说效果很好,您将无法看到该链接,但它会生成如下内容:

http://dev.mywebsite.com/events/email/welcome

让我们上线(假装没有进一步的更改) )

git checkout master
git merge my-awesome-branch
git push origin master
cap production deploy

理论上,该文件应该推送到实时网站(即 http://mywebsite.com/events/email/welcome),但当我进行生产部署时,不会创建该网页。

另一位更熟悉该系统的开发人员说:

看来您分叉了“我的派对活动”存储库并推送了 那里有师傅。您需要将 master 推送到上游远程( 主要“我的派对活动”,或 my_events 存储库。)

我不遵循此步骤。有人能遵循这个逻辑吗?如果是这样,您对我可能做错的事情有什么建议吗?任何帮助表示赞赏。

I am trying to learn github to deploy a webpage. Here are the steps I am taking:

git checkout master
git pull origin master
git checkout –b my-awesome-branch

Do some work, do a git status to check on everything, everything is ok.

git add .
git commit –m "awesome message here"
git push origin my-awesome-branch
git checkout integration
git merge my-awesome-branch
git push origin integration
cap development deploy

this will push a file to the dev server we have so people can look at it - this worked fine for me you won't be able to see the link but it generates something like this:

http://dev.mywebsite.com/events/email/welcome

Let's go live (pretending there are no further changes)

git checkout master
git merge my-awesome-branch
git push origin master
cap production deploy

In theory, the file should push to the live website (which would be http://mywebsite.com/events/email/welcome) but that webpage is not created when i cap production deploy.

Another developer more familiar with this system says :

It looks like you forked "my party events" repo and have pushed the
master there. You'll want to push master to the upstream remote (the
main "my party events", or my_events repo.)

I don't follow this step. Can anyone follow this logic? If so, do you have a suggestion for me on what i may be doing wrong? Any help is appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冰葑 2024-12-12 20:14:42

如果您在 Github 上有一个分叉分支,则意味着您的名下拥有整个 git 存储库的副本。检查您的 Github 帐户以验证这一点。

为此,请访问https://github.com/your-github-user-name-here。在左侧,查找“my-party-events”(假设这是存储库名称)。在其下方,查找“forked from xyz/my-party-events”。

如果您没有看到'forked from ...',那么您就是该存储库的原始所有者。情况不应该如此。

如果您确实看到'forked from ...',那么您的名下就有一份副本(这就是分叉)。您对分叉所做的任何更改都不会影响原始存储库。

如果你同意我的观点,有两种方法可以选择。

通过 Git(推荐)

每当您之前执行 git pullgit Push 时,您都会指定来源,这是您之前设置的存储库的人类可读名称。存储库地址实际上看起来像这样

[email protected]:your-user-name/project-name.git

正如您所看到的,用“origin”之类的昵称来引用它更容易记住。

假设您对主项目存储库具有写入权限,您只需将另一个存储库添加到您的配置中即可。 在尝试此操作之前,请确保您具有写入权限,否则您只是在浪费时间。如果您不确定,请询问您的同事。

假设您想将存储库昵称为“生产”,您可以这样做

git remote add production [email protected]:PROJECT_OWNER/project-name.git

git 存储库地址看起来与您的 fork 存储库几乎相同。仅用户名不同。在所有 Github 项目的首页上,存储库地址都位于文本字段中。它位于“SSH | HTTPS | Git Read-only”按钮旁边。从那里获取地址,将其替换到上面的命令中,最后在命令行中执行此操作

git push production master

从现在开始,您只需git push production master即可,这非常简单。如果您没有写入权限,则必须通过拉取请求提交更改。

通过网站

您可以向您派生的存储库提交拉取请求。拉取请求要求原始存储库管理员包含您对分叉所做的更改。

要提交拉取请求,请从项目页面单击您的项目分支。查找右上角附近的“拉取请求”图标。这应该会带您进入一个页面,您可以在其中选择目标分支和源分支。

If you have a forked branch on Github, that means you have a copy of the entire git repo under your name. Check your Github account to verify this.

To do this, go to https://github.com/your-github-user-name-here. On the left side, look for "my-party-events" (assuming that's the repo name). Underneath it, look for "forked from xyz/my-party-events".

If you don't see 'forked from ...', then you're the original owner of that repo. This shouldn't be the case.

If you do see 'forked from ...', then you have a copy under your name (that's what a fork is). Any changes you make to a fork don't affect the original repo.

If you're with me up to here, there's 2 ways you can go.

Via Git (Recommended)

Whenever you did a git pull or git push earlier, you were specifying origin, which is a human-readable name for a repo that you set up earlier. The repo address actually looks like this

[email protected]:your-user-name/project-name.git

As you can see, referring to it by a nickname like 'origin' is way easier to remember.

Assuming you have write access to the main project repo, you can just add another repo to your config. Make sure you have write access before attempting this, otherwise you're just wasting your time. Ask your coworker if you're not sure.

Lets say you wanted to nickname the repo as 'production', you would do this

git remote add production [email protected]:PROJECT_OWNER/project-name.git

The git repo address looks almost identical to your fork repo. It differs only by username. On the front page of all Github projects, the repo address is in a text field. It's next to the "SSH | HTTPS | Git Read-only" buttons. Get the address from there, replace it in the command above, and finally, do this in your command line

git push production master

From now on, you can just git push production master, which is pretty simple. If you don't have write access, then you'll have to submit changes via pull requests.

Through the Website

You can submit a pull request to the repo you forked from. A pull request asks the original repo admin to include changes you've made on your fork.

To submit a pull request, click on your project fork from your projects page. Look for the 'Pull Request' icon near the top right. That should take you to a page where you can choose the target and source branches.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文