git:get_started
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| git:get_started [2018/08/27 11:18] – typos | git:get_started [2024/08/20 21:38] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 56: | Line 56: | ||
| {{git: | {{git: | ||
| + | |||
| + | 2. **Register SSH Encryption Public Key: | ||
| Now that we've generated an SSH public-private encryption key-pair, we need to let GitHub Enterprise know the public key and that it is associated to your account. | Now that we've generated an SSH public-private encryption key-pair, we need to let GitHub Enterprise know the public key and that it is associated to your account. | ||
| Line 91: | Line 93: | ||
| ===== Clone a Repository | ===== Clone a Repository | ||
| - | Here we present an example walk through in which we will clone a repository on our machine. | + | Here we present an example walk through in which we will clone a repository, ' |
| + | |||
| + | From the ' | ||
| + | |||
| + | {{git: | ||
| + | |||
| + | Select 'Clone or download' | ||
| + | |||
| + | Next, open a terminal. Create a directory, in your /home area, within which you'd like clone and work on Git repositories. For the sake of this example, we'll name this directory ' | ||
| + | < | ||
| + | cd | ||
| + | mkdir gt_git | ||
| + | </ | ||
| + | |||
| + | Next, create a directory for the Git Organization in which the repository resides. In this case, the ' | ||
| + | < | ||
| + | cd ~/gt_git | ||
| + | mkdir Snakey | ||
| + | cd Snakey/ | ||
| + | </ | ||
| + | |||
| + | Now clone the repository, | ||
| + | < | ||
| + | git clone git@github.gatech.edu: | ||
| + | </ | ||
| + | |||
| + | A snapshot of expected terminal output is illustrated, | ||
| + | {{git: | ||
| + | |||
| + | ===== Add a File to Repository | ||
| + | Let's a add a new file to our repository! | ||
| + | < | ||
| + | cd ~/ | ||
| + | touch my_new_file.txt | ||
| + | ls | ||
| + | </ | ||
| + | A new file named ' | ||
| + | |||
| + | The following command will inform you of whether changes have been made to your local (version of the) repository, causing it to be out of sync with the remote repository. | ||
| + | < | ||
| + | git status | ||
| + | </ | ||
| + | We first need to inform Git of any new files that it must track on our local machine. | ||
| + | < | ||
| + | git add my_new_file.txt | ||
| + | </ | ||
| + | Now that the file is tracked, we can ' | ||
| + | < | ||
| + | git commit -m "added new example text file" | ||
| + | </ | ||
| + | The ' | ||
| + | |||
| + | Finally, we can push the staged changes to the remote repository, | ||
| + | < | ||
| + | git push origin master | ||
| + | </ | ||
| + | |||
| + | Expected terminal output, | ||
| + | |||
| + | {{git: | ||
| + | |||
| + | ===== Update a File in Repository | ||
| + | We previously added an empty file, ' | ||
| + | |||
| + | Now let's modify it and update the changes to the remote repository! | ||
| + | < | ||
| + | cd ~/ | ||
| + | echo "Hello World!" | ||
| + | cat my_new_file.txt | ||
| + | </ | ||
| + | The commands above were a quick way to add simple text to our previously empty file. It now contains the text 'Hello World!' | ||
| + | |||
| + | If we run '' | ||
| + | |||
| + | Commit the changed file so that it can be uploaded to the remote server, | ||
| + | < | ||
| + | git commit -am "added some example text" | ||
| + | </ | ||
| + | The ' | ||
| + | |||
| + | Now push the staged changes to the remote repository, | ||
| + | < | ||
| + | git push origin master | ||
| + | </ | ||
| + | |||
| + | Example terminal output is illustrated, | ||
| + | |||
| + | {{git: | ||
| + | |||
| + | We additionally, | ||
| + | |||
| + | {{git: | ||
| + | |||
| + | ===== Remove a File from Repository | ||
| + | In our final example walk through, we'll remove the text file we created from the repository and propagate this update/ | ||
| + | |||
| + | < | ||
| + | cd ~/ | ||
| + | git rm my_new_file.txt | ||
| + | </ | ||
| + | |||
| + | '' | ||
| + | |||
| + | Commit the change (ie. file deletion) to be staged for upload to the remote rpo. | ||
| + | < | ||
| + | git commit -m " | ||
| + | </ | ||
| + | |||
| + | Push the change, | ||
| + | < | ||
| + | git push origin master | ||
| + | </ | ||
| + | |||
| + | Example terminal output is illustrated, | ||
| - | Within the ' | + | {{git: |
git/get_started.1535383135.txt.gz · Last modified: 2024/08/20 21:38 (external edit)
