需要一些基本的 github 帮助
我正在尝试学习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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您在 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 pull
或git Push
时,您都会指定来源,这是您之前设置的存储库的人类可读名称。存储库地址实际上看起来像这样正如您所看到的,用“origin”之类的昵称来引用它更容易记住。
假设您对主项目存储库具有写入权限,您只需将另一个存储库添加到您的配置中即可。 在尝试此操作之前,请确保您具有写入权限,否则您只是在浪费时间。如果您不确定,请询问您的同事。
假设您想将存储库昵称为“生产”,您可以这样做
git 存储库地址看起来与您的 fork 存储库几乎相同。仅用户名不同。在所有 Github 项目的首页上,存储库地址都位于文本字段中。它位于“SSH | HTTPS | Git Read-only”按钮旁边。从那里获取地址,将其替换到上面的命令中,最后在命令行中执行此操作
从现在开始,您只需
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
orgit 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 thisAs 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
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
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.