赞
踩
1. Personal access tokens
Tokens you have generated that can be used to access the GitHub API.
Make sure to copy your new personal access token now. You won’t be able to see it again!
bfebc7934***********************
Personal access tokens function like ordinary OAuth access tokens. They can be used instead of a password for Git over HTTPS, or can be used to authenticate to the API over Basic Authentication.
1. 上传ssh pub key到github
2.
[allen@oc1623636125 ~]$ git clone git@github.com:allen-shun/jenkins.git
Cloning into 'jenkins'...
The authenticity of host 'github.com (13.229.188.59)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
RSA key fingerprint is MD5:16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,13.229.188.59' (RSA) to the list of known hosts.
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (6/6), 5.68 KiB | 0 bytes/s, done.
[allen@oc1623636125 ~]$ ls -ltr
-rw-rw-r--. 1 allen allen 1460012 Nov 6 15:17 secfixdb.RedHat7Server
drwxrwxr-x. 3 allen allen 4096 Nov 6 15:35 jenkins
[allen@oc1623636125 jenkins]$ git branch dev-allen
[allen@oc1623636125 jenkins]$ git checkout dev-allen
Switched to branch 'dev-allen'
[allen@oc1623636125 jenkins]$ ls -ltra
total 48
drwxr-xr-x. 64 allen allen 20480 Nov 6 15:35 ..
-rw-rw-r--. 1 allen allen 9 Nov 6 15:35 README.md
-rw-rw-r--. 1 allen allen 42460 Nov 6 15:35 close_rcp_v9_new.py
drwxrwxr-x. 8 allen allen 4096 Nov 6 15:42 .git
[allen@oc1623636125 jenkins]$ vi close_rcp_v9_new.py
[allen@oc1623636125 jenkins]$
[allen@oc1623636125 jenkins]$
[allen@oc1623636125 jenkins]$ git diff
diff --git a/close_rcp_v9_new.py b/close_rcp_v9_new.py
index f9677a5..55a4c02 100644
--- a/close_rcp_v9_new.py
+++ b/close_rcp_v9_new.py
@@ -1,4 +1,5 @@
#!/bin/python3
+#add text for git
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait, Select
[allen@oc1623636125 jenkins]$ git diff main
diff --git a/close_rcp_v9_new.py b/close_rcp_v9_new.py
index f9677a5..55a4c02 100644
--- a/close_rcp_v9_new.py
+++ b/close_rcp_v9_new.py
@@ -1,4 +1,5 @@
#!/bin/python3
+#add text for git
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait, Select
[allen@oc1623636125 jenkins]$
[allen@oc1623636125 jenkins]$ git add close_rcp_v9_new.py
[allen@oc1623636125 jenkins]$
[allen@oc1623636125 jenkins]$ git commit -m "add text for git"
[dev-allen 3fe6fc8] add text for git
Committer: this is my id1 <allen@oc1623636125.ibm.com>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
1 file changed, 1 insertion(+)
[allen@oc1623636125 jenkins]$ git config --global user.name "Allen"
[allen@oc1623636125 jenkins]$ git config --global user.email 546608304@qq.com
[allen@oc1623636125 jenkins]$ git push origin dev-allen
Warning: Permanently added the RSA host key for IP address '52.74.223.119' to the list of known hosts.
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 345 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
remote:
remote: Create a pull request for 'dev-allen' on GitHub by visiting:
remote: https://github.com/allen-shun/jenkins/pull/new/dev-allen
remote:
To git@github.com:allen-shun/jenkins.git
* [new branch] dev-allen -> dev-allen
[allen@oc1623636125 jenkins]$
查看pull request或生成新的pull request:
选择"compare & pull request"
点击“create pull reqeust”
然后出现“”
选择:“Merge pull request”
选择: "Confirm merge"
Merged以后,就可以点击"Delete branch"来删除 dev-allen
在本地local:
[allen@oc1623636125 jenkins]$ git checkout main
Switched to branch 'main'
[allen@oc1623636125 jenkins]$ git branch -D dev-allen
Deleted branch dev-allen (was 3c92721).
[allen@oc1623636125 jenkins]$
如果需要再次提交自己更新:
确保本地master(main)分支是最新的状态:, 然后在重复上面的步骤:
[allen@oc1623636125 jenkins]$ git pull origin main:main
Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (1/1), done.
From github.com:allen-shun/jenkins
0712f9c..8c2e900 main -> main
Warning: fetch updated the current branch head.
Warning: fast-forwarding your working tree from
Warning: commit 0712f9c98ce61f10b7e2b458ad08cef8f093d6ee.
Already up-to-date.
[allen@oc1623636125 jenkins]$
查看当前在哪个branch:
[allen@oc1623636125 jenkins]$ git branch
* main
[allen@oc1623636125 jenkins]$
如果当前在local 的main branch下,可以简写成:
[allen@oc1623636125 jenkins]$ git pull origin main
From github.com:allen-shun/jenkins
* branch main -> FETCH_HEAD
Already up-to-date.
**********************************************************************************************************************************************************************************************************************
在本地重新创建dev-allen
[allen@oc1623636125 jenkins]$ git branch dev-allen
[allen@oc1623636125 jenkins]$
[allen@oc1623636125 jenkins]$ git pull origin dev-allen:dev-allen
From github.com:allen-shun/jenkins
! [rejected] dev-allen -> dev-allen (non-fast-forward)
[allen@oc1623636125 jenkins]$ git pull origin dev-allen:dev-test2
From github.com:allen-shun/jenkins
* [new branch] dev-allen -> dev-test2
Already up-to-date.
[allen@oc1623636125 jenkins]$
[allen@oc1623636125 jenkins]$ git pull origin main:dev-allen
Already up-to-date.
[allen@oc1623636125 jenkins]$ git branch
dev-allen
* main
[allen@oc1623636125 jenkins]$ git commit -m "test for commit a"
# On branch main
# Your branch is behind 'origin/main' by 3 commits, and can be fast-forwarded.
# (use "git pull" to update your local branch)
#
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。