forked from Shoray2002/practice-git
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added steps to clone and push changes to github from local
- Loading branch information
1 parent
62fe46b
commit 6608466
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Cloning and Pushing | ||
|
||
Cloning downloads a repository to your computer, where you can work on it using your favorite tools. After you have made the necessary changes, you can commit and push the changes to the *remote*(i.e., github servers) from your *local*(i.e., your computer). | ||
|
||
## Setup | ||
|
||
After you have created an account on github, I suggest you set up your local as described [here](https://docs.github.com/en/authentication/connecting-to-github-with-ssh), as it will make subsequent steps easier. After you have set this up, you should be able to run `ssh [email protected]` and see the following message: | ||
|
||
``` | ||
$ ssh [email protected] | ||
PTY allocation request failed on channel 0 | ||
Hi pranavgade20! You've successfully authenticated, but GitHub does not provide shell access. | ||
Connection to github.com closed. | ||
``` | ||
|
||
If you see this, you are good to go! | ||
|
||
## Cloning | ||
|
||
To clone your repository, use `git clone [email protected]:username/repo_name.git`. Then, change directory to `repo_name` with `cd repo_name`. You can now use any editor to make changes to the files. | ||
|
||
We will create a new directory called images and add an image to the directory. Go to `repo_name` and create a new folder called `images`. Then, take a screenshot of the output `ssh [email protected]` gives you, and add it to the directory. | ||
|
||
## Committing | ||
|
||
Add the files to the *staging area* by running `git add images/` in the `images` directory. Then, you can commit them with `git commit -m 'commit message'`. You can replace the commit message with a line describing what this commit is. | ||
|
||
If you'd like to see the current status of the repository, you can `git status`. | ||
|
||
To see the changes you will be committing, you can run `git diff` and/or `git diff --staged`. The first command shows the changes if the file isn't added to the staging area with `git add`. The second shows the difference in the staging area. | ||
|
||
## Pushing | ||
|
||
Finally, `git push` to push the changes to the remote. Assuming you have completed the setup properly, this step should be seamless. | ||
|
||
After the changes are pushed, you can create a PR to the original repository, just like the last time. | ||
|
||
### Next steps | ||
|
||
Next steps are in BRANCHES.md | ||
|
||
|
||
|