ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How to put my workspace on Github?

asked 2022-04-21 15:47:07 -0500

zippyzoo77 gravatar image

updated 2022-04-30 13:39:49 -0500

lucasw gravatar image


For the last year or so I have been working on and editing and running simulations in my catkin workspace based on several different ros packages. In order to customize them for my own specific situations, I have edited many of the files in my src directory, but not all of them, and not in large ways. I recently got a new computer (with a larger RAM/memory than my personal machine) and I need to rebuild what I have done on my personal machine on this new machine (and possibly again so a colleague can join me in working on this project over the summer). It seems like the best way to do this would be to create my own private repo on Github with my edited versions of these packages, then install and rebuild my workspace on my new machine. The problem is I am really struggling to figure out how to do this, since I am still very new to how github repos work. I have found lots on how to clone repos, but not how to upload/create them. I know that it is general practice not to include things like the build and dev folders, and things like that from reading, but I just don't know what to do to get this to work. I'm trying to avoid redownloading and building each package from their own sources, since like I said, I have made small changes to hundreds of files within these packages, and I don't want to have to go find and redo each tiny change I have made over the last year.

So how do I put the parts of my workspace that I need to be able to rebuild it on my new machine? Specifically, things like what do I type in the command line, or drag and drop, or what? I just don't know what I'm supposed to do to get this set up.


edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2022-04-22 07:07:04 -0500

Joe28965 gravatar image

I would not create a new repo, but create a fork from the repo's of the packages you've edited and push your edited work to the fork. That makes more sense than creating a new repo, especially if most of the work isn't yours (it's not illegal or anything, don't worry, I just personally wouldn't create a new repo instead of a fork in these situations).

Then there are 2 options, the lazy way would be to clone your forked repo to some other place on your pc and just copy the packages you've edited and paste them into your forked repo (just literally do this from the file explorer like you would merge 2 folders on Windows). Just tell it to 'replace all' when you get the prompt. Then just simply commit and push like you would any other git repo

The second option is more complex, and I'm not too versed in git to properly explain it, so I'm not going to do that.

You and your friend will then be able to both work on that fork over the summer (just remember to not work on the same branch, to avoid merge conflicts on a branch).

As for your final portion of your question. On your new pc you will need to create a new workspace + src folder, clone your forked repos (the ones you've pushed your changes to) and rebuild your packages. That's something you'll always need to do with ROS when starting on a new pc.

edit flag offensive delete link more

answered 2022-04-21 17:42:59 -0500

ljaniec gravatar image

I think you can base your approach on some known good ROS packages, e.g. Navigation stack. You should have a repository called my-modified-packages with packages from your catkin_ws/src/ (your own and forked ones with modified files etc.), after cloning this repository to the catkin_ws/src/ + building and sourcing the workspace on the new PC everything should be OK.

I worked this way with the Navigation2 stack with some package modifications in its repository without any major problems

edit flag offensive delete link more

answered 2022-04-21 17:15:19 -0500

prajwal98 gravatar image

Hi, it's better to upload your src, launch files (basically everything execpt log ,devel,build folder ) because you may need to build it again on a new machine anyway. but you can upload your whole workspace and clean build it again after cloning it from Github.

suppose you have a workspace (ros_ws) and have Github account 1. create a empty GitHub repo how to create repo 2. upload your whole work space folder how to uplod folder now you can clone it in another machine and build it again. for this, you can do 3. cd ros_ws catkin clean catkin make don't forget to source your workspace again using source ros_ws/devel/setup.bash

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2022-04-21 15:47:07 -0500

Seen: 559 times

Last updated: Apr 22 '22