I am very new to using Github. I am only used to writing code in my local device. I need to pull a repo off of github, create a new file inside of the repo (Which will have my .java program), and push it back to github. I have looked online but the explanations are pretty confusing to me (As a beginner).
4 Answers
Check to make sure you have git installed locally first:
Run in your command line:
git --version
If it returns a git version, then go to the github repository and copy the path like so:
In your command line type
git clone
followed by the path (paste it in) like so:From the above example:
Press return or enter. The repository will be cloned and set up for you locally.
After the cloning is finished, you can
cd
directly into the repository. In the above example I would type:cd cordova-runner
Assuming you have been given contributor rights from the repository's owner, you can from there make changes, branch, add, commit, and push back to the repository. If you haven't been given rights, you can do the same process, but fork the repo first.
I hope this helps.

- 5,358
- 2
- 23
- 27
Download and install the git command line tool: https://git-scm.com/downloads
If you're on windows, there's a git bash many people prefer over cmd. On any other operating system, just use the terminal/cli.
Once installed, first you'll want to clone the repository. You'll find the URL on the repository page after clicking the green "Clone or download" button:
git clone [url]
https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository
Then you'll add your file to be tracked by git:
git add [filename]
https://git-scm.com/docs/git-add
Then you'll commit your changes.
git commit -m "Added a file like a champ!"
https://git-scm.com/docs/git-commit
Then you'll push your changes, provided you have permissions to push.
git push [remote name] [branch]
Use git remote -v
to view your remote names and URLs. Your remote name is default "origin" at first so if your branch name is "develop," it would be git push origin develop
https://git-scm.com/docs/git-push
The alternative, and the correct way to do it, is to fork the repo, make your changes, commit and push your changes to your remote repo, then create a pull request on the original repo's branch: https://help.github.com/articles/about-pull-requests/
Pull requests are requesting the other person pull your changes into their branch. This gets into merging and such: https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging
I provided documentation links in an effort to persuade you to check them out. Both github and git provide excellent documentation. There are also countless git tutorials online, many are interactive and really help you learn this brand of source control.

- 230
- 1
- 6
Git clone <--Url to repository-->
Git checkout <--branchname-->
Create your file
Git pull (to again sync the repo with remote repo)
Git add
Git commit -m "write comment here"
Git push

- 555
- 1
- 7
- 22
All you need to do is
svn co https://github.com/path/to/repo
... create your new file ...
svn add your_file
svn commit your_file -m "Message about new file."
and then you're done.

- 1,505
- 2
- 15
- 27
-
-
Github works with SVN. https://github.com/blog/626-announcing-svn-support – user1139069 Aug 02 '17 at 23:07
-
-