Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

Working with git heavily streamlines code distribution, version tracking, and branching for different beamtimes. However, connecting this (or any) GitHub repository into your S3DF directory is not as straightforward as setting up github on your local computer. Below are the steps to do this.

Connecting a Git Repository to GitHub via SSH on the S3DF Cluster

To make push/pull requests from Github, there is a little extra legwork, but we only have to do this once and it (should) never have to be done again. Since we are on the S3DF cluster, we cannot use HTTP requests to pull/push changes from the remote repository. We have to use SSH. Note: All UNIX commands should be run on S3DF, not your local computer.

1. Check for Existing SSH Keys

ls -al ~/.ssh
  • Look for files named id_ed25519 and id_ed25519.pub or similar (you can use rsa, but it is outdated). These are your SSH private and public keys.
  • If no keys are present, proceed to the next step to generate one.

2. Generate a New SSH Key (if needed)

ssh-keygen -t ed25519 -C "your_email@example.com"
  • Replace "your_email@example.com" with the email associated with your GitHub account.
  • Press Enter to save the key in the default location (~/.ssh/id_ed25519).
  • Optionally, set a passphrase for added security.

3. Add the SSH Key to the SSH Agent

Start the SSH agent:

eval "$(ssh-agent -s)"

Add your private key to the agent:

ssh-add ~/.ssh/id_ed25519

4. Add the SSH Key to Your GitHub Account

Copy your public SSH key to the clipboard:

cat ~/.ssh/id_ed25519.pub

Highlight and copy the full output. Go to your GitHub account:

Navigate to Settings > SSH and GPG keys > New SSH key. Paste the key into the "Key" field and give it a descriptive title, something like "S3DF". Click Add SSH key.

5. Test the SSH Connection

Run:

ssh -T git@github.com

If successful, you'll see a message like:

Hi username! You've successfully authenticated, but GitHub does not provide shell access.

Great! Now that you have that set up, you never have to do it again. Now, we can move on to creating or cloning a repository.

Creating a repository and linking it to GitHub

The simplest way to get started is to use GitHub's guidance. Create a new repository without a .gitignore or README.md file. In the quickstart menu, select SSH as the protocol, and then copy the first set of commands. Navagate to the directory where you want this repository to be saved and paste the commands into the terminal and press enter. Now, you're all set up!

  • Use
    git add <filename>
    to add files to the repository or
    git add .
    to add all files.
  • To commit changes, use
    git commit -m "Put your message here"
    and add your own message to tell others what you did.
  • To push your commits to GitHub, simply use
    git push
  • And to pull changes from GitHub, simply use
    git pull

Tips and Tricks

  • Add a .gitignore to your directory to specifically mark certain files to not be added to the repository. Specifically in regard to the S3DF cluster, it would probably be a good idea to ignore any hdf5 files, as these are usually pretty large and GitHub has a file size limit of 100 Mb. To do this, simply run the command
    echo '*.h5' >> .gitignore
    This will create the .gitignore file and add the string "*.h5" into it, which tells git to ignore any file that has the extensions .h5. More documentation on .gitignore syntax can be found easily online.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors