Save changes to GitHub
Prepare the GeoNode fork
Go to GitHub
https://github.com/GeoNode/geonode
and select the correct version/branch linked to thegeonode-project
cat requirements.txt
# -e git+https://github.com/GeoNode/geonode.git@4.1.x#egg=GeoNode
Click on the
Fork
button and select the targetrepository
; make sure you uncheck theCopy the master branch only
option!Wait for the process to finish. When it is completed, you will be able to see GeoNode in your own
repository
with the same branches and the same commits asupstream
Add the Fork and Branch to the Code
Click on the
Code
dropdown and copy the newfork URL
Go back to the shell and navigate to
cd /opt/geonode
Type the following commands
# Add the new GitHub remote address git remote add <a name> <the fork URL> <-- e.g.: git remote add afabiani https://github.com/afabiani/geonode.git # Update the .git references git fetch --all # Create a new branch git checkout -b geonode_training_4x # Double check you switched to the correct branch git branch 4.1.x * geonode_training_4x # Push the new branch to your fork git push <name of the remote> <name of the branch <-- e.g: git push afabiani geonode_training_4x
Example:
git push afabiani geonode_training_4x Total 0 (delta 0), reused 0 (delta 0) remote: remote: Create a pull request for 'geonode_training_4x' on GitHub by visiting: remote: https://github.com/afabiani/geonode/pull/new/geonode_training_4x remote: To https://github.com/afabiani/geonode.git * [new branch] geonode_training_4x -> geonode_training_4x
Generate a Push Token
GitHub will ask you to provide a
user/password
to performpushes/commits
, but it will force you to create atoken
To create (or refresh) a
token
, go tosettings
Click on
Developer Settings
Generate a new
token
Provide a
name
andexpiration date
. Select theprivileges
. The ones below will allow you to push commits to the repositoryCopy the new
token
and store it somewhere. Otherwise, you will need to refresh it
Commit the Changes to GitHub
Check the repository status
cd /opt/geonode
git status
On branch geonode_training_4x
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: geonode/base/api/serializers.py
modified: geonode/base/forms.py
modified: geonode/base/models.py
Untracked files:
(use "git add <file>..." to include in what will be committed)
geonode/base/migrations/0061_resourcebase_custom_md.py
geonode/base/migrations/0062_auto_20210910_1445.py
no changes added to commit (use "git add" and/or "git commit -a")
Add the
unchecked
files to thecommit
git add geonode/base/migrations/0061_resourcebase_custom_md.py geonode/base/migrations/0062_auto_20210910_1445.py
git status
On branch geonode_training_4x
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: geonode/base/migrations/0061_resourcebase_custom_md.py
new file: geonode/base/migrations/0062_auto_20210910_1445.py
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: geonode/base/api/serializers.py
modified: geonode/base/forms.py
modified: geonode/base/models.py
Create a
commit
andpush
the changes
git commit -a -m " - Added a custom_md field to the GeoNode ResourceBase metadata"
git status
On branch geonode_training_4x
nothing to commit, working tree clean
git log
commit b359f1c49a1196727a6af9fa916cb11b6d28dbdd (HEAD -> geonode_training_4x)
Author: afabiani <alessio.fabiani@geo-solutions.it>
Date: Mon Sep 13 14:24:52 2021 +0100
- Added a custom_md field to the GeoNode ResourceBase metadata
commit 911a0f14eb7204c622c807ba877b4a2dce3e3caa (afabiani/geonode_training_4x, 4.1.x)
Author: Toni <toni.schoenbuchner@csgis.de>
Date: Tue Aug 31 17:57:04 2021 +0200
added jcaceres85
(cherry picked from commit 5553d1882718d38c742e6e4a86bf1ad51f14fb15)
# Conflicts:
# .clabot
[...]
Push the changes to the remote repository in the format
git push <name of the remote> <name of the branch
Example
git push afabiani geonode_training_4x Enumerating objects: 19, done. Counting objects: 100% (19/19), done. Delta compression using up to 2 threads Compressing objects: 100% (11/11), done. Writing objects: 100% (11/11), 1.34 KiB | 684.00 KiB/s, done. Total 11 (delta 9), reused 0 (delta 0) remote: Resolving deltas: 100% (9/9), completed with 8 local objects. To https://github.com/afabiani/geonode.git 911a0f14e..b359f1c49 geonode_training_4x -> geonode_training_4x
Create a new repository for the GeoNode project
The steps are similar to the ones above, except that this time we have to create a brand new repository from scratch instead of forking an existing one.
Initialize the working directory as a git repository
cd /opt/geonode-project/my_geonode git init
Create a new repository on GitHub
Go to
https://github.com/<name>?tab=repositories
(e.g.https://github.com/afabiani?tab=repositories
), and create a newrepository
Provide a name
Copy the link
Add the
repository
to thegeonode-project
git remote add <a local name> https://github.com/<fork name>/my_geonode.git <-- e.g.: git remote add afabiani https://github.com/afabiani/my_geonode.git
# Update the refs
git fetch --all
# Create a new branch
git checkout -b main
# Check the status of the local files and add all of them to the commit
git status
git add -A
git status
# Create a new commit along with a message
git commit -a -m " - My GeoNode"
# Finally, push to the repository
git push afabiani main
Link geonode-project
to the Correct GeoNode Distribution
Edit the
geonode-project
dependency file
cd /opt/geonode-project/my_geonode
vim requirements.txt
diff --git a/requirements.txt b/requirements.txt
index d4b80df..7700b59 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1 @@
-# -e git+https://github.com/GeoNode/geonode.git@4.1.x#egg=GeoNode
-GeoNode==4.0
\ No newline at end of file
+-e git+https://github.com/afabiani/geonode.git@geonode_training_4x#egg=GeoNode
Commit and push the changes to the remote repository
git status
On branch main
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: requirements.txt
no changes added to commit (use "git add" and/or "git commit -a")
git commit -m " - Link my_geonode to the correct GeoNode dist" requirements.txt
[main 7e62c60] - Link my_geonode to the correct GeoNode dist
1 file changed, 1 insertion(+), 2 deletions(-)
git push afabiani main
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 2 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 362 bytes | 362.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/afabiani/my_geonode.git
a40f891..7e62c60 main -> main