rkoudsi / dice_simulator

GNU General Public License v3.0
0 stars 0 forks source link

push the file #4

Closed rkoudsi closed 2 years ago

rkoudsi commented 2 years ago

add, commit, and push the change to the server

rkoudsi commented 2 years ago

after completing #2, you can go on the command line and run git status to see changes to the project (you will have to run this command after cding into the project directory.

After seeing that a file x has changed, you can add that file to the changes you want to push to the server using the git add command. If the file is called dice_sim.py, you can add it with the command git add dice_sim.py

Then you can tell git that you want to finalize this change. You can do that with git commit -m"put a meaningful message here". Make sure the message makes sense and describes what changed and why it has changed. The message should be short like less than a sentence.

After you've committed youre changes, let the server know about these changes. You can do this with the command git push. This pushes all your changes to the server so that others can see them.

emarkworth commented 2 years ago

its asking for a password for me to push changes to the server.

rkoudsi commented 2 years ago

Set up your ssh keys to connect your computer to GitHub. This link can give you some helpful tips. You want to skip the section that has stuff about a hardware security key. Also when you are creating a key and it asks for an optional passphrase, I would leave it empty so that it makes it easier for you to use in the future.

Note that this is not something done often. You do this once ever for every new computer you use. Once you set this up on your computer, you'll be able to work on any project (not just this one).

rkoudsi commented 2 years ago

Heard you're having trouble with the keys. This comment may help a bit.

Create a key

Check if you have a key already

Open terminal and run cat ~/.ssh/id_rsa.pub. If it says no such file then go to the section on creating a key. If it prints out some wild code then go to the section for adding your key to GItHub.

Creating a key

Note: Don't follow this section if you already have a key.

  1. Open terminal and run ssh-keygen.
  2. When it asks for a file just press enter. By not typing anything you tell it to use the default.
  3. When it asks you to enter a passphrase just press enter. A passphrase is optional and we wont use one here.

Add your key to GitHub

  1. Copy your key. You can view your key by running cat ~/.ssh/id_rsa.pub
    • cat will show the contents of the file
    • the filename ends in "pub" to signify this is your public key. This key is OK to give to GitHub. Never share your private key with anyone including GitHub. Your private key is held in "~/.ssh/id_rsa"
    • when copying, copy the entire thing. It should start with "ssh-rsa" and end in something like the name of your computer
  2. log into GitHub
  3. Go to your profile settings
  4. On the left click on ssh keys (here is a direct link)
  5. Click the green button "New SSH Key"
  6. The title can be anything. If Github lets you leave this blank, it will fill in a default name. Default name is fine.
  7. Paste the key you previously copied from the terminal
  8. Finalize by clicking the "Add SSH key" button