Using Git under eComStation: Difference between revisions
mNo edit summary |
|||
(10 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
This is just a quick introduction on how to use git.exe on OS/2 and eComStation. The use of git.exe is the same as in other platforms. My goal was to make a quick tutorial of using git.exe with the GitHub website to clone, commit and push the content. | This is just a quick introduction on how to use git.exe on OS/2 and eComStation. The use of git.exe is the same as in other platforms. My goal was to make a quick tutorial of using git.exe with the GitHub website to clone, commit and push the content. | ||
==Introduction== | ==Introduction== | ||
===What is git.exe=== | ===What is git.exe=== | ||
[[Git]] is a distributed version control and source code management (SCM) system with an emphasis on speed [http://en.wikipedia.org/wiki/Git_%28software%29]. It is something similar to [[CVS]] or [[SUBVERSION]] (SVN). | [[Git]] is a distributed version control and source code management (SCM) system with an emphasis on speed [http://en.wikipedia.org/wiki/Git_%28software%29]. It is something similar to [[CVS]] or [[SUBVERSION]] (SVN). | ||
===What is github.com=== | ===What is github.com=== | ||
GitHub.com is a service on the Web that provides free and public git repository. | GitHub.com is a service on the Web that provides a free and public git repository. | ||
* If you want to host a free, open source and open for the public project it is free of charge. | * If you want to host a free, open source and open for the public project it is free of charge. | ||
* If you want to host a personal, close to the public project, you will have to pay a fee. | * If you want to host a personal, close to the public project, you will have to pay a fee. | ||
GitHub offers the code repository, wikis, issues tracking tools, and it is very easy to fork open source projects. If you are a developer and want to try little changed to an open source project, it just takes you one click to "fork" the project and create a copy of the code on your own GitHub repository. | GitHub offers the code repository, wikis, issues tracking tools, and it is very easy to fork open source projects. If you are a developer and want to try a little changed to an open source project, it just takes you one click to "fork" the project and create a copy of the code on your own GitHub repository. | ||
Bitbucket.org is another similar site on the web with much the same offerings as GitHub and as well as supporting git also supports Mercurial, another SCM with similar usage as git. | Bitbucket.org is another similar site on the web with much the same offerings as GitHub and as well as supporting git also supports Mercurial, another SCM with similar usage as git. | ||
==Requirements== | ==Requirements== | ||
According to the git RPM installer | According to the git RPM installer, these are the packaged dependencies. | ||
* ash | * ash | ||
* ca-certificates | * ca-certificates | ||
Line 30: | Line 29: | ||
* urpo | * urpo | ||
* zlib | * zlib | ||
==Installation== | ==Installation== | ||
If you have RPM/Yum installed you can run: | If you have RPM/Yum installed, you can run: | ||
yum install git | yum install git | ||
As an alternative, there is also this port, [http://bauxite.sakura.ne.jp/software/os2/#git]. | |||
As an alternative there is also this port, [http://bauxite.sakura.ne.jp/software/os2/#git]. | |||
Read the included readme for installation instructions. | Read the included readme for installation instructions. | ||
==First-Time Git Setup== | ==First-Time Git Setup== | ||
The first step on Git is to set your name and e-mail address. You can do this with on the command promt with: | The first step on Git is to set your name and e-mail address. You can do this with on the command promt with: | ||
git config --global user.name "John Doe" | git config --global user.name "John Doe" | ||
git config --global user.email johndoe@example.com | git config --global user.email johndoe@example.com | ||
Some other configuration: | |||
git config --global core.editor "'C:/os2/e.exe' -multiInst -notabbar -nosession -noPlugin" | |||
This changes get stored on the .gitconfig file that is generally stored on "C:\home\xxx\config" directory. | |||
==Getting a Token== | |||
Github improved the security of it's site, and now it is hard (or not possible) to push the changes of the source code just with a user ID and password. Now you need to generate a token on Github for your use and use that token to push your changes. | |||
===Generating the Token=== | |||
#Log into GitHub with your username and password | |||
#Navigate to your GitHub account settings | |||
#Scroll down and click ‘Developer settings’ in the list of links to the left | |||
#Click the Personal access tokens link | |||
#Click the ‘Generate new token’ button | |||
#Add a ‘Note’ to describe the tokens usage | |||
#Set an expiration date for the GitHub personal access token | |||
#Select the appropriate authentication scope | |||
#Click the ‘Generate token’ button | |||
#Copy your token code. | |||
===Push command with Token=== | |||
Once you are ready to push your code, you can run: | |||
git push https://<TOKEN>@github.com/<USERNAME>/<REPONAME>.git | |||
Like a sample for my case (I hid my token with xxxx) | |||
git push https://xxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@github.com/martiniturbide/UTIL-WPS-Bubblepad.git | |||
==Cloning a repository== | ==Cloning a repository== | ||
Line 120: | Line 133: | ||
The -1 means to use the last commit, -2 would mean the last 2 commits etc. | The -1 means to use the last commit, -2 would mean the last 2 commits etc. | ||
A file will be in your repository containing the | A file will be in your repository containing the formatted patch, in this case, | ||
From 58e1fac763188ed5711fce6b96283e73561b2e4e Mon Sep 17 00:00:00 2001 | From 58e1fac763188ed5711fce6b96283e73561b2e4e Mon Sep 17 00:00:00 2001 | ||
Line 150: | Line 163: | ||
==Push== | ==Push== | ||
Now I want to push the | |||
===Without Token=== | |||
Now I want to push the committed changed to the github repository. So inside the project folder I run the following: | |||
[D:\git\UTIL-WPS-Bubblepad]git push | [D:\git\UTIL-WPS-Bubblepad]git push | ||
It will quickly ask your github user name and password. Remember that you will need access to the repository you are uploading content. When you type them no input is showed on the command line, don't worry about it, just be sure to type the username and password correctly. | It will quickly ask your github user name and password. Remember that you will need access to the repository you are uploading content. When you type them no input is showed on the command line, don't worry about it, just be sure to type the username and password correctly. | ||
Username: | Username: | ||
Password: | Password: | ||
Line 162: | Line 175: | ||
Total 6 (delta 4), reused 0 (delta 0) | Total 6 (delta 4), reused 0 (delta 0) | ||
6479ef2..6627f1f master -> master | 6479ef2..6627f1f master -> master | ||
Now check your GitHub page. You will see the new file there. | Now check your GitHub page. You will see the new file there. | ||
[[Image:GitHubTest1.png]] | [[Image:GitHubTest1.png]] | ||
===With Token=== | |||
If you are using github, you require a token and it will be something like: | |||
git push https://xxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@github.com/martiniturbide/UTIL-WPS-Bubblepad.git | |||
==Adding Files== | ==Adding Files== | ||
Line 171: | Line 187: | ||
So I created a "crapfile.txt" file inside the /WPS-BubblePad directory. After that I executed: | So I created a "crapfile.txt" file inside the /WPS-BubblePad directory. After that I executed: | ||
[D:\git\UTIL-WPS-Bubblepad]git add *.* | [D:\git\UTIL-WPS-Bubblepad]git add *.* | ||
No message is returned. | No message is returned. | ||
After that I did some a commit: | After that I did some a commit: | ||
[D:\git\UTIL-WPS-Bubblepad]git commit -a -m 'Crapfile' | [D:\git\UTIL-WPS-Bubblepad]git commit -a -m 'Crapfile' | ||
The response was: | The response was: | ||
[master ed6e926] Crapfile | [master ed6e926] Crapfile | ||
1 files changed, 1 insertions(+), 0 deletions(-) | 1 files changed, 1 insertions(+), 0 deletions(-) | ||
create mode 100644 crapfile.txt | create mode 100644 crapfile.txt | ||
And the push to upload it to the repository. | And the push to upload it to the repository. | ||
[D:\git\UTIL-WPS-Bubblepad]git push | [D:\git\UTIL-WPS-Bubblepad]git push | ||
And here it is a similar response for the push: | And here it is a similar response for the push: | ||
Username: | Username: | ||
Password: | Password: | ||
Line 199: | Line 208: | ||
==Final Words== | ==Final Words== | ||
This was just a quickly introduction on how to use git.exe with a GitHub site. Of course that Git has a lot of functionality and additional features. | This was just a quickly introduction on how to use git.exe with a GitHub site. Of course that Git has a lot of functionality and additional features. | ||
Use git help for a quick overview of commands and for additional help use git help COMMAND, eg git help commit. | Use git help for a quick overview of commands and for additional help use git help COMMAND, eg git help commit. | ||
==Errors== | ==Errors== | ||
===No Templates and No "https" helper=== | ===No Templates and No "https" helper=== | ||
[C:\programs\git]git clone https://github.com/OS2World/WPS-Bubblepad.git | [C:\programs\git]git clone https://github.com/OS2World/WPS-Bubblepad.git | ||
warning: /bin/sh is not found. cmd.exe will be used alternatively. | warning: /bin/sh is not found. cmd.exe will be used alternatively. | ||
Line 224: | Line 230: | ||
fatal: Unable to find remote helper for 'https' | fatal: Unable to find remote helper for 'https' | ||
It seems that some | It seems that some requirement is missing from the git.exe required libraries. | ||
You can also try using the git transport like: | |||
git clone git://www.github.com/OS2World/UTIL-WPS-Bubblepad.git | |||
Notice that you use git:// instead for https:// | |||
===error: Terminal is dumb, but EDITOR unset=== | ===error: Terminal is dumb, but EDITOR unset=== |
Latest revision as of 16:06, 4 December 2022
This is just a quick introduction on how to use git.exe on OS/2 and eComStation. The use of git.exe is the same as in other platforms. My goal was to make a quick tutorial of using git.exe with the GitHub website to clone, commit and push the content.
Introduction
What is git.exe
Git is a distributed version control and source code management (SCM) system with an emphasis on speed [1]. It is something similar to CVS or SUBVERSION (SVN).
What is github.com
GitHub.com is a service on the Web that provides a free and public git repository.
- If you want to host a free, open source and open for the public project it is free of charge.
- If you want to host a personal, close to the public project, you will have to pay a fee.
GitHub offers the code repository, wikis, issues tracking tools, and it is very easy to fork open source projects. If you are a developer and want to try a little changed to an open source project, it just takes you one click to "fork" the project and create a copy of the code on your own GitHub repository.
Bitbucket.org is another similar site on the web with much the same offerings as GitHub and as well as supporting git also supports Mercurial, another SCM with similar usage as git.
Requirements
According to the git RPM installer, these are the packaged dependencies.
- ash
- ca-certificates
- cube
- libc
- libcurl
- libgcc444
- libgcc446
- openssl
- os2-base
- os2-mpts
- pthread
- urpo
- zlib
Installation
If you have RPM/Yum installed, you can run:
yum install git
As an alternative, there is also this port, [2]. Read the included readme for installation instructions.
First-Time Git Setup
The first step on Git is to set your name and e-mail address. You can do this with on the command promt with:
git config --global user.name "John Doe" git config --global user.email johndoe@example.com
Some other configuration:
git config --global core.editor "'C:/os2/e.exe' -multiInst -notabbar -nosession -noPlugin"
This changes get stored on the .gitconfig file that is generally stored on "C:\home\xxx\config" directory.
Getting a Token
Github improved the security of it's site, and now it is hard (or not possible) to push the changes of the source code just with a user ID and password. Now you need to generate a token on Github for your use and use that token to push your changes.
Generating the Token
- Log into GitHub with your username and password
- Navigate to your GitHub account settings
- Scroll down and click ‘Developer settings’ in the list of links to the left
- Click the Personal access tokens link
- Click the ‘Generate new token’ button
- Add a ‘Note’ to describe the tokens usage
- Set an expiration date for the GitHub personal access token
- Select the appropriate authentication scope
- Click the ‘Generate token’ button
- Copy your token code.
Push command with Token
Once you are ready to push your code, you can run:
git push https://<TOKEN>@github.com/<USERNAME>/<REPONAME>.git
Like a sample for my case (I hid my token with xxxx)
git push https://xxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@github.com/martiniturbide/UTIL-WPS-Bubblepad.git
Cloning a repository
Command Line
First locate yourself into the directory where you want to project to be cloned. To clone a git repository from GitHub for example you can do it by the command line:
git clone https://github.com/OS2World/UTIL-WPS-Bubblepad.git
You will get this message:
Cloning into UTIL-WPS-Bubblepad... remote: Counting objects: 33, done. remote: Compressing objects: 100% (22/22), done. remote: Total 33 (delta 9), reused 26 (delta 8) Unpacking objects: 100% (33/33), done.
This will create a clone of the "UTIL-WPS-Bubblepad" repository on the directory from which you called git.exe.
Checking Changes
If you have modified some files in your local repository copy you can get inside your repository folder and execute:
[D:\git\WPS-Bubblepad]git status
You will get this message of the modified files.
# On branch master # Your branch is ahead of 'origin/master' by 1 commit. # # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: README.md # no changes added to commit (use "git add" and/or "git commit -a")
On this case I had modified only the "README.md" file.
To see your actual changes execute git diff
You will get a unified diff output.
diff --git a/README.md b/README.md index 172dd6b..7a53b40 100644 --- a/README.md +++ b/README.md @@ -17,4 +17,5 @@ AUTHORS LINKS ============= -* http://www.os2world.com/cdwriting/bubblepad/bubblepadmain.htm \ No newline at end of file +* http://www.os2world.com/cdwriting/bubblepad/bubblepadmain.htm +* https://github.com/OS2World/UTIL-WPS-Bubblepad.git \ No newline at end of file
At this point you can add an empty line at the end of the file, important if a source file.
Commit
To commit the changed you need to run a command like:
[D:\git\UTIL-WPS-Bubblepad]git commit -a -m 'Changes to Readme'
You will get a message like:
[master 6627f1f] Changes to Readme 1 files changed, 2 insertions(+), 1 deletions(-)
Format Patch
To format a patch for sending a formatted patch to a project you can use a command like:
[D:\git\UTIL-WPS-Bubblepad]git format-patch -1 0001-Changes-to-Readme.patch
The -1 means to use the last commit, -2 would mean the last 2 commits etc. A file will be in your repository containing the formatted patch, in this case,
From 58e1fac763188ed5711fce6b96283e73561b2e4e Mon Sep 17 00:00:00 2001 From: Joe Foo <joe.foo@gmail.com> Date: Thu, 5 Sep 2013 20:16:05 -0700 Subject: [PATCH] Changes to Readme --- README.md | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/README.md b/README.md index 172dd6b..aceabc5 100644 --- a/README.md +++ b/README.md @@ -17,4 +17,5 @@ AUTHORS LINKS ============= -* http://www.os2world.com/cdwriting/bubblepad/bubblepadmain.htm \ No newline at end of file +* http://www.os2world.com/cdwriting/bubblepad/bubblepadmain.htm +* https://github.com/OS2World/UTIL-WPS-Bubblepad.git -- 1.7.2.3
This can be attached to an email message and sent upstream for review and committing. It is also possible for git to actually send the patch as an email but is beyond this simple tutorial.
Push
Without Token
Now I want to push the committed changed to the github repository. So inside the project folder I run the following:
[D:\git\UTIL-WPS-Bubblepad]git push
It will quickly ask your github user name and password. Remember that you will need access to the repository you are uploading content. When you type them no input is showed on the command line, don't worry about it, just be sure to type the username and password correctly.
Username: Password: Counting objects: 8, done. Compressing objects: 100% (6/6), done. Writing objects: 100% (6/6), 578 bytes, done. Total 6 (delta 4), reused 0 (delta 0) 6479ef2..6627f1f master -> master
Now check your GitHub page. You will see the new file there.
With Token
If you are using github, you require a token and it will be something like:
git push https://xxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@github.com/martiniturbide/UTIL-WPS-Bubblepad.git
Adding Files
But what about if you want to add new files instead of just changing something?
So I created a "crapfile.txt" file inside the /WPS-BubblePad directory. After that I executed:
[D:\git\UTIL-WPS-Bubblepad]git add *.*
No message is returned.
After that I did some a commit:
[D:\git\UTIL-WPS-Bubblepad]git commit -a -m 'Crapfile'
The response was:
[master ed6e926] Crapfile 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 crapfile.txt
And the push to upload it to the repository.
[D:\git\UTIL-WPS-Bubblepad]git push
And here it is a similar response for the push:
Username: Password: Counting objects: 4, done. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 296 bytes, done. Total 3 (delta 1), reused 0 (delta 0) 6627f1f..ed6e926 master -> master
Final Words
This was just a quickly introduction on how to use git.exe with a GitHub site. Of course that Git has a lot of functionality and additional features. Use git help for a quick overview of commands and for additional help use git help COMMAND, eg git help commit.
Errors
No Templates and No "https" helper
[C:\programs\git]git clone https://github.com/OS2World/WPS-Bubblepad.git warning: /bin/sh is not found. cmd.exe will be used alternatively. Cloning into WPS-Bubblepad... warning: templates not found /@unixroot/usr/share/git-core/templates
The "/share/git-core/templates" directory is not in the right location. By default it looks for it on your @unixroot directory. You can edit your file ".gitconfig" and change the path to the correct directory. Just add:
[init] templatedir = <path>/share/git-core/templates
No "https" helper
[C:\programs\git]git clone https://github.com/OS2World/WPS-Bubblepad.git warning: /bin/sh is not found. cmd.exe will be used alternatively. Cloning into WPS-Bubblepad... fatal: Unable to find remote helper for 'https'
It seems that some requirement is missing from the git.exe required libraries.
You can also try using the git transport like:
git clone git://www.github.com/OS2World/UTIL-WPS-Bubblepad.git
Notice that you use git:// instead for https://
error: Terminal is dumb, but EDITOR unset
[D:\git\WPS-Bubblepad]git commit error: Terminal is dumb, but EDITOR unset Please supply the message using either -m or -F option.
The editor is not configured on the .gitconfig configuration file.