从Eclipse向GitHub提交代码

3
如何使用eclipse将代码提交到GitHub服务器?
当我运行这个命令时
git push -u origin master

它显示以下错误

错误: 访问https://github.com/something/something时返回错误:403

3个回答

5

虽然我不是专家,但我曾经完成过这项任务。

简单直接的方法是:

1.在您的系统上下载Git

2.进入您的Eclipse项目所在目录 cd /workspace/sampleproject

3.执行以下命令

git config --global user.name "Your Name Here"
git config --global user.email "your_email@youremail.com"
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 an error but no problem

4. 从Eclipse->帮助->Eclipse Marketplace中搜索“git” -> 安装“Egit-git团队提供者”。

5. 进入Eclipse ->窗口 ->打开视图 ->Git存储库。

6. 在Git存储库视图的左侧选择“添加现有本地存储库”,然后浏览到“/工作空间/示例项目”。

7. 现在右键单击此已添加的存储库位置并添加注释,按下提交按钮。

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.

2
如果您正在使用https地址,则需要通过凭据(Github登录和密码)进行验证。 参见“与github同步”中的示例。
对于Eclipse和Egit,您可以在为本地repo定义远程地址时设置这些凭据。参见“推送到上游”。

upstream credential


0

只需打开项目视图并点击Git,您将看到项目的工作副本 - > 在项目上右键单击,选择提交选项。就是这样

或者

在项目上右键单击,选择团队,您可以看到与git命令相关的各种选项,选择提交。


"commit"完全不起作用。看起来它在做一些事情,但是没有任何内容被提交到GitHub仓库中。 - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接