In this post we will upload a local project to a remote repository. invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Develo per/CommandLineTools/usr/bin/xcrun
- Create a new Java project named “test” under directory “F:\Github” or you can have your existing project here. E.g. You will have bin, src folder in “F:\Github\test” directory.
- In GitShell, change current directory to “test” and initialize a new Git repository here.
cd F:\Github\test git init
- Check repository status and verify that it is properly initialized using
- Add all untracked files to git repo using
git add *. No output but if you do git status, you will see all untracked files have been moved to “changes to be committed” section.
- Create your first local commit on repository using
git commit -m "Initial project commit".
- Remote repository: Go to your account on www.github.com and create a new repository named test. Uncheck the checkbox to create ReadMe file for now. Copy the https path of remote repo, e.g. https://github.com/rohitkandhal/test.git.
- Switch back to Git shell and add the remote repo URL to your local git repo config file using:
git remote add origin https://github.com/rohitkandhal/test.gitAt this point, git shell might report fatal: remote origin already exists. It is a known issue and workaround is Stackoverflow: git push origin master doesn’t work.
- Now push your local git repository contents to server (or remote repository) using the following command. If you have properly configured remote url then this command should work fine.
git push -u origin masterCommand details origin is the default name of the remote repository you created. By above command, git shell pushes (or commits) your local repository changes to the remote repository on the branch specified (wiz. master here).
- Additional note: In case while creating remote repository on github.com, you added default readme.md to your repository then before git push, you first need to pull remote repository.
git pull origin masterThen your local changes will be merged automatically when you will push
git push -u origin master
- Done.Check your remote repository, it should have your latest changes.