Skip to content

Commit 47c3de2

Browse files
committed
show how to recover from cloning upstream; closes #250
1 parent b2d94a3 commit 47c3de2

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

content/forking-workflow.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,52 @@ accept modifications without having to grant write access to others.
8989
## Help and discussion
9090

9191

92+
### Help! I don't have permissions to push my local changes
93+
94+
Maybe you see an error like this one:
95+
```text
96+
Please make sure you have the correct access rights
97+
and the repository exists.
98+
```
99+
100+
Or like this one:
101+
```text
102+
failed to push some refs to cr-workshop-exercises/forking-workflow-exercise.git
103+
```
104+
105+
In this case you probably try to push the changes not to your fork but to the original repository
106+
and in this exercise you do not have write access to the original repository.
107+
108+
The simpler solution is to clone again but this time your fork.
109+
110+
:::{solution} Recovery
111+
112+
But if you want to keep your local changes, you can change the remote URL to point to your fork.
113+
Check where your remote points to with `git remote --verbose`.
114+
115+
It should look like this (replace `your-user` with your GitHub username):
116+
```console
117+
$ git remote --verbose
118+
119+
origin git@github.com:your-user/forking-workflow-exercise.git (fetch)
120+
origin git@github.com:your-user/forking-workflow-exercise.git (push)
121+
```
122+
123+
It should **not** look like this:
124+
```console
125+
$ git remote --verbose
126+
127+
origin git@github.com:cr-workshop-exercises/forking-workflow-exercise.git (fetch)
128+
origin git@github.com:cr-workshop-exercises/forking-workflow-exercise.git (push)
129+
```
130+
131+
In this case you can adjust "origin" to point to your fork with:
132+
```console
133+
$ git remote set-url origin git@github.com:your-user/forking-workflow-exercise.git
134+
```
135+
:::
136+
137+
92138
### Opening a pull request towards the upstream repository
93139

94140
We have learned in the previous episode that pull requests are always from

0 commit comments

Comments
 (0)