Using a GitHub Personal Access Token (PAT) to Push/Pull from a SageMaker Notebook
-Last updated on 2024-11-03 | +
Last updated on 2024-11-06 | Edit this page
@@ -379,6 +379,9 @@workshop
+setup.
Step 1: Generate a Personal Access Token (PAT) on GitHub
- Go to Settings > Developer settings > Personal access
@@ -426,21 +429,19 @@
Directory setup
PYTHON
-%cd /home/ec2-user/SageMaker/
-!pwd
+%cd /home/ec2-user/SageMaker/
Step 1: Generate a Personal Access Token (PAT) on GitHub
- Go to Settings > Developer settings > Personal access
@@ -426,21 +429,19 @@
Directory setup
PYTHON
-
+%cd /home/ec2-user/SageMaker/ -!pwd
%cd /home/ec2-user/SageMaker/
PYTHON<
import getpass
# Prompt for GitHub username and PAT securely
-github_url = 'github.com/UW-Madison-DataScience/test_AWS.git' # found under Code -> Clone -> HTTPS (remote the https:// before the rest of the address)
-username = input("GitHub Username: ")
-token = getpass.getpass("GitHub Personal Access Token (PAT): ")
+username = input("GitHub Username: ")
+token = getpass.getpass("GitHub Personal Access Token (PAT): ")
import getpass
# Prompt for GitHub username and PAT securely
-github_url = 'github.com/UW-Madison-DataScience/test_AWS.git' # found under Code -> Clone -> HTTPS (remote the https:// before the rest of the address)
-username = input("GitHub Username: ")
-token = getpass.getpass("GitHub Personal Access Token (PAT): ")
Note: After running, you may want to comment out the above code so that you don’t have to enter in your login every time you @@ -715,7 +715,8 @@
PYTHON<
PYTHON
# Push with embedded credentials from getpass (avoids interactive prompt)
-!git push https://{username}:{token}@{github_url} main
+github_url = 'github.com/username/ML_with_Amazon_SageMaker.git' # replace username with your own. THe full address for your fork can be found under Code -> Clone -> HTTPS (remote the https:// before the rest of the address)
+!git push https://{username}:{token}@{github_url} main
# Push with embedded credentials from getpass (avoids interactive prompt)
-!git push https://{username}:{token}@{github_url} main