简体   繁体   中英

How do I push my local Java project in Eclipse that is version controlled to GitHub?

What I was trying to do was create a local Java project in Eclipse that is version controlled and push it to GitHub so that my other group members can clone this project and begin their own work. I have followed the steps that my professor has provided and made the local project; however, when I go to push it I get the following error (see image). Is it because I already have a master branch created and if so do I need to delete it first? I am going to provide an image of the dashboard of my GitHub repository in addition to the link to the instructions document my professor provided us if that will help to better grasp my question or my process. This is an image of the error that I am receiving. This is an image of my GitHub repository dashboard. Here is the link to the instructions that my professor provided.

First clone the repository you've created in any of your drives and create project in that cloned folder and try to push it up! It will work!

Hi i think you didn't pull the code before commit. May be in your team mate someone push their code earlier, so you need to pull their changes to your local there after only you need to push your change.

Please pull from your repo and then try to commit.

Goto your eclipse, open the view in the menu 'Git Repositories'.

Ensure you see your local repository and can see the remote repository as a subfolder. In my version, it's called Remotes, and then I can see the remote project within that.

Look for the green arrow pointing to the left, this is the 'fetch' arrow. Right click and select 'Configure Fetch'.

You should see the URI, ensure that it points to the remote repository.

Look in the ref mappings section of the pop-up. Mine was empty. This will indicate which remote references you want to fetch. Click 'Add'.

Type in the branch name you need to fetch from the remote repository. Mine was 'master' (btw, a dropdown here would be great,,. for now, you have to type it). Continue through the pop-up, eventually clicking 'Finish'.

Click 'Save and Fetch'. This will fetch that remote reference.

Look in the 'Branches' folder of your local repository. You should now see that remote branch in the remote folder. Again, I see 'master'.

Right-Click on the local branch in the 'Local' folder of 'Branches', which is named 'master'. Select 'Merge', and then select the remote branch, which is named 'origin/master'.

Process through the merge.

Commit any changes to your local repository.

Push your changes to the remote repository.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM