2

如何使用 eclipse 将代码提交到 GitHub 服务器?

当我运行这个命令

git push -u origin master

它显示以下错误

错误:请求的 URL 返回错误:访问 https://github.com/something/something时出现 403

4

3 回答 3

5

我不是专家,但我做过一次

认为简单直接的方法是

1.下载Git到你的系统

2.cd 到你的 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市场->搜索'git'->安装'Egit-git team provider'

5.转到eclipse->Windows->打开透视图->Git存储库

6.从“添加现有本地存储库”左侧的 Git 存储库视图,然后浏览到“/workspace/sampleproject”

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.
于 2013-01-24T07:51:11.807 回答
2

如果您使用的是 https 地址,则需要传递您的凭据(Github 登录名和密码)。有关示例,
请参阅“与 github 同步”。

使用 Eclipse 和 Egit,您可以在为本地存储库定义远程地址时设置这些凭据。
请参阅“向上游推送”。

上游凭证

于 2013-01-24T07:33:53.353 回答
0

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

或者

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

于 2017-03-10T12:21:42.870 回答