将代码从 Eclipse 提交到 GitHub
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14495934/
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
Commit code from eclipse to GitHub
提问by Nitesh Singh Rajput
How to commit code into GitHub Server using eclipse ?
如何使用 eclipse 将代码提交到 GitHub 服务器?
when I run this command
当我运行此命令时
git push -u origin master
It shows the following error
它显示以下错误
error: The requested URL returned error: 403 while accessing https://github.com/something/something
错误:请求的 URL 在访问https://github.com/something/something 时返回错误:403
回答by gYanI
I am not expert but i have done this once
我不是专家,但我做过一次
think simple and straight way is
认为简单直接的方法是
1.Download Git to your system
1.下载Git到你的系统
2.cd to your eclipse prject cd /workspace/sampleproject
2.cd 到你的 eclipse 项目 cd /workspace/sampleproject
3.Commands
3.命令
git config --global user.name "Your Name Here"
git config --global user.email "[email protected]"
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/gitusername/reposname.git
git push -u origin master this line may throw error but no problem
4.From eclipse ->Help->eclpise marketplace ->search for 'git' -> install 'Egit-git team provider'
4.从eclipse ->Help->eclpise market ->search for 'git' -> install 'Egit-git team provider'
5.Go to eclipse ->Windows ->Open perspective ->Git repository
5.进入eclipse ->Windows ->Open透视图->Git仓库
6.From Git repository view on left side on 'Add existing local repos' then brows to '/workspace/sampleproject'
6.从左侧的“添加现有本地存储库”的 Git 存储库视图,然后浏览到“/workspace/sampleproject”
7.Now Right clik on this added Repository location and add comments press Commit.
7.现在右键单击此添加的存储库位置并添加评论按提交。
8.Now Right clik on this added Repository click Push
8.现在右键单击此添加的存储库单击推送
By default Configured remote repository should be checked then press Next
From Source Ref and Destination Ref Select HEAD //you may change if u want
Select next give your github username and password then click on Finish.
回答by VonC
If you are using the https address, you need to pass your credential (Github login and password).
See "Syncing with github" for an example.
如果您使用的是 https 地址,则需要传递您的凭据(Github 登录名和密码)。
有关示例,请参阅“与 github 同步”。
With Eclipse and Egit, you can set those credential when defining a remote address for your local repo.
See "Push upstream".
使用 Eclipse 和 Egit,您可以在为本地存储库定义远程地址时设置这些凭据。
参见“推上游”。
回答by Rakesh Basa
Just Open the project perspective and click on Git, you will see the working copies of your project --> right-click on the project and choose the option commit. That's it
只需打开项目透视图并单击 Git,您将看到项目的工作副本 --> 右键单击项目并选择选项提交。就是这样
or
或者
Right-click on your project and select team you can see various options related to git commands choose commit.
右键单击您的项目并选择团队,您可以看到与 git 命令相关的各种选项选择提交。