如何提交到远程 git 存储库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10364429/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to commit to remote git repository
提问by Ahmed
I am new to git.
I have done a clone of remote repo as follows
我是 git 新手。
我做了一个远程仓库的克隆如下
git clone https://[email protected]/repo.git
then I did
然后我做了
git checkout master
made some changes and committed these changes to my local repository like below..
进行了一些更改并将这些更改提交到我的本地存储库,如下所示..
git add .
git commit -m "my changes"
Now I have to push these changes to the remote repository.
I am not sure what to do.
现在我必须将这些更改推送到远程存储库。
我不知道该怎么做。
Would I do a merge of my repo to remote ?
what steps do I need to take ?
我会把我的 repo 合并到 remote 吗?
我需要采取哪些步骤?
I have git bash and git gui
我有 git bash 和 git gui
please advise,
thanks,
请指教,
谢谢
采纳答案by zafarkhaja
All You have to do is git push origin master
, where origin
is the default name (alias) of Your remote repository and master
is the remote branch You want to push Your changes to.
您所要做的就是git push origin master
,origin
您的远程存储库的默认名称(别名)在哪里,以及master
您要将更改推送到的远程分支。
You may also want to check these out:
您可能还想查看这些:
回答by Sergey K.
You just need to make sure you have the rights to push to the remote repository and do
您只需要确保您有权推送到远程存储库并执行
git push origin master
or simply
或者干脆
git push
回答by haziz
git push
git push
or
或者
git push server_name master
git push server_name master
should do the trick, after you have made a commit to your local repository.
在您提交到本地存储库之后,应该可以解决问题。
回答by Bryan Oakley
Have you tried git push? gitref.orghas a nice section dealing with remote repositories.
你试过git push吗?gitref.org有一个很好的部分处理远程存储库。
You can also get help from the command line using the --help
option. For example:
您还可以使用该--help
选项从命令行获取帮助。例如:
% git push --help
GIT-PUSH(1) Git Manual GIT-PUSH(1)
NAME
git-push - Update remote refs along with associated objects
SYNOPSIS
git push [--all | --mirror | --tags] [-n | --dry-run] [--receive-pack=<git-receive-pack>]
[--repo=<repository>] [-f | --force] [-v | --verbose] [-u | --set-upstream]
[<repository> [<refspec>...]]
...