I’ve been trying to upload my code to a github repo, so I can work on it from school. Despite getting some help from another team through CD, I am still confused how to do this. I can figure out how to upload my code to a .git file on my pc, but I have no idea how to upload that to the repo on the github website.
If any additional info is needed for you to help, please ask!
Simple guide using Git bash:
- Navigate to your workspace using the ‘cd’ command
(Creates an empty repository)
git remote add origin <SSH clone URL>
(Adds the remote repository as ‘origin.’ is the URL given to you by GitHub, resembilng firstname.lastname@example.org:Username/RepositoryName.git
git add -A
(Adds current files to the repository)
git commit -am 'Initial commit'
(Creates a commit with added files)
git push origin master
(Pushes local commits to the remote repository)
It is recommended that you have a decent .gitignore file in the root directory of your workspace, in order to keep unnecessary files out of the repository. A good example of a .gitignore file can be found here.
Please take the time to actually understand git before using it with other people. Don’t just copy paste commands from guides online.
I am currently reading your guide to learn how to properly use Git, thanks!
Sorry if it appears like I’m in a rush, this code does need to be uploaded fast. (Currently going to upload the code, and then work on properly learning git)
EDIT: Managed to post the code to our repo! I’m continuing to learn git as I go on, but at least I can work on robot code from anywhere now
In terms of .gitignore, you can pretty much just use the /dist/ file. You don’t really need anything else.
*~ /bin/ sysProps.xml /build/ /dist/
Yeah, looking back, I didn’t think that reply through. Here’s a .gitignore that I like. It leaves pretty much only the src.
You shouldn’t need to ignore .xml files. In fact, you shouldn’t, especially if your project uses a framework such as Maven, which is based off xml files, or if your project uses an XML properties file.