Tracking Project Commits on GitHub While Pushing Code to a Non-GitHub Server

I am fairly experienced with using GitHub for my own personal projects, but I’ve only been pushing code to GitHub servers.

At the company I work at, we use Bitbucket and push code to one of our organization’s internal servers. SourceTree is the app we use to track commits.

I was wondering if the same can be done with GitHub - is it possible to use GitHub to track all project commits in our repo while pushing to a remote that is a server in our organization, rather than pushing to the GitHub server?

For example, we set a a repo that we are able to view on GitHub. But instead of the remote being something like ‘https://github.com/companyName/project.git’, can the remote be a network path to one of our servers like ‘//companyServer/repos/project.git’? If so, how can I set this up?

You can have as many remotes as you want on a local repository. If you want to push to both GitHub and a local server just add both and push to both. See: Git - Working with Remotes :slightly_smiling_face:

Git does not directly support Windows network shares (that’s what your example looks like to me), but it does support local directories as remotes. So you’d have to mount the share locally and then use a directory on the network drive as the remote.

Thanks for your answer!

So for my example, I actually only want a single remote as my company’s local server. I can initialize a git repo on this local server and clone it to my project directory on my local machine. But is there a way to push code to this local server and track changes on GitHub, without setting up another remote and pushing to GitHub at the same time?

Do you mean that if you push to the local server the changes should automatically show up on GitHub, too? You could set up a cron job or service that pushes from the local server to a GitHub repo, either regularly or triggered by a suitable Git hook.

Sorry for not being clear, I think there’s a misunderstanding.

I don’t want any source code to be pushed to GitHub at all. I want everything to be pushed to my local server, but I’d like to review code pushed on this local server on my GitHub account.

This is currently possible with our Bitbucket setup, but I have a feeling this isn’t possible with GitHub haha…