git 如何通过终端推送gitlab中的代码更改文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39503607/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:16:42  来源:igfitidea点击:

How to push the code changes files in gitlab through terminal

gitgitlab

提问by sree

I had done commited those changed files but i can't able to push the code into the gitalb through terminal. Can you please help me. Thank you advance.

我已经提交了那些更改过的文件,但我无法通过终端将代码推送到 gitalb 中。你能帮我么。先谢谢了。

回答by Shaggy

I hope you have committed the code properly using this command:

我希望你使用这个命令正确提交了代码:

git commit -m "commit message"

git commit -m "提交消息"

Now check your remote whether it points to the repository in the GitLab using :

现在使用以下命令检查您的遥控器是否指向 GitLab 中的存储库:

git remote -v

git远程 -v

It may show you something like this if remote is present:

如果远程存在,它可能会向您显示类似的内容:

sample-group    http://10.212.0.147:8888/shaggy/myProject.git (fetch)
sample-group    http://10.212.0.147:8888/shaggy/myProject.git (push)
origin  http://10.212.0.147:8888/shaggy/myProject.git (fetch)
origin  http://10.212.0.147:8888/shaggy/myProject.git (push)

If the remote location of GitLab is not present then add the remote using the command :

如果 GitLab 的远程位置不存在,则使用以下命令添加远程:

git remote add origin your_GitLabs_repository_URL

git remote add origin your_GitLabs_repository_URL

Again check the remote

再次检查遥控器

git remote -v

git远程 -v

Now you are ready to push the repository to the GitLab repoisoty using te command

现在您已准备好使用 te 命令将存储库推送到 GitLab 存储库

git push origin master

git push origin master

For your reference https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/

供您参考https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/

https://docs.gitlab.com/ee/ci/quick_start/README.html

https://docs.gitlab.com/ee/ci/quick_start/README.html

回答by Vikranth

If you have an Github account already within then project but you want to add the code to Gitlab without losing github remote then

如果您在项目中已经有一个 Github 帐户,但您想将代码添加到 Gitlab 而不丢失 github remote 那么

Step-1: Commit the code

步骤 1:提交代码

Step-2: Go to gitlab and get the remote url for your project

第 2 步:转到 gitlab 并获取项目的远程 url

Step-3: Go to your project and start the terminal and then type in the following comnnand

第 3 步:转到您的项目并启动终端,然后输入以下命令

git remote add origin1

git 远程添加 origin1

Step-4: Push the code

第 4 步:推送代码

git push origin1 master

git push origin1 master