I've been using Git on and off for about two years, but have mostly been lazy and depended upon the Github Desktop: -
especially for commits and pushes.
I'm using an Enterprise Github instance, as hosted by IBM - which is nice.
However, of course, I still have a set of local GIt repositories, native to my Mac, as per this example: -
/Users/davidhay/Git/WASScripts
So, in the interest of self-enablement, I dug further into using the command-line interface.
The first trick was to create a Personal Access Token: -
which I could use in lieu of a password, when connecting from the command-line to Git.
Having generated a token, I then did some tinkering: -
Change to my local Git repository, for WebSphere Application Server (WAS) scripts
cd ~/Git/WASScripts
Create a file
touch snafu.txt
Add the file to the local Git repo
git add snafu.txt
Commit the changes to Enterprise Github
git commit
[master 92f77cd] Adding snafu.txt
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 snafu.txt
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 snafu.txt
This brings up vi and requires me to add some comments; I then save these using :wf or [Escape][z][z]
Push the changes to Enterprise Github
git push
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 281 bytes | 281.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.ibm.com/ukiccte/WASScripts.git
64af5d4..92f77cd master -> master
Validate that the file now appears in Github Enterprise
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 281 bytes | 281.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.ibm.com/ukiccte/WASScripts.git
64af5d4..92f77cd master -> master
Validate that the file now appears in Github Enterprise
Remove the file locally
git rm snafu.txt
rm 'snafu.txt'
Commit the changes to Enterprise Github
git commit
[master 4773e77] Removing snafu.txt
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 snafu.txt
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 snafu.txt
Push the changes to Enterprise Github
git push
Counting objects: 2, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 236 bytes | 236.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.ibm.com/ukiccte/WASScripts.git
92f77cd..4773e77 master -> master
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 236 bytes | 236.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.ibm.com/ukiccte/WASScripts.git
92f77cd..4773e77 master -> master
Validate that we're in sync
git commit
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
Validate that the file has now been removed from Github Enterprise
Nice !
Amongst many other fine sources, I did find this to be immensely useful: -
from the awesome Julia Evans ( https://twitter.com/b0rk )
No comments:
Post a Comment