Arun
Arun

Reputation: 118799

Deciding a Git workflow

I am a Bioinformatician and I'm the only one working on my project. And all my code/scripts have to be stored on the storage space accessible to the cluster nodes (to which I can connect via SFTP and mount via SMB). I am interested in setting up a git repository primarily to:

a) keep track of changes
b) cloning repositories to work locally and push later to origin/remote repo

I would like to use sourceTree to manage my repositories. There are two ways I could think of in establishing this:

1) Use SMB to mount and access the storage space. This allows for me to set up a bare remote repository under, say, $HOME/Git and I can clone this empty repository to my actual working folder, say, $HOME/projects using sourceTree. I suppose its like working locally (once you have mounted the remote storage space). Now I can add files, commit and push to origin (in $HOME/Git). The primary workflow then from both work and home would be to work on the cloned repository under $HOME/projects folder. If I know that I'd be going offline for a while and would like to work on it, then, I can clone to my laptop and work locally during this period and then push later.

2) Directly set up a non-bare git repository under $HOME/projects. Now, create a local repository using SSH method on both my work and home computers and remember to push every time. I would have to work around the problem of git push error '[remote rejected] master -> master (branch is currently checked out)' by checking out the remote repository creating another branch and pushing to master from the local repository as outlined in this post.

Do you have a better alternative? (or) Which one would you recommend?

Thank you very much in advance!

Upvotes: 1

Views: 126

Answers (1)

Chronial
Chronial

Reputation: 70693

Don’t push to non-bare repositories – you are asking for trouble. Set up a central repository that you can access from everywhere that you push and pull from. So: use the first method.

And if you are a git beginner I would strongly recommend using the command line client. That way you will properly learn what’s going on and understand git.

Upvotes: 4

Related Questions