只是完整更改项目的本地仓库路径,不更改内容的情况下(特别是.git没有更改的情况下,),是否依然可以成功上传到Github远程仓库?
先上结论:可以!
1、改项目路径
原路径如下:
E:\DownloadFiles\BaiduNetdiskDownload\AndroidStudy\00 PDF\AndroidProgramming3eMm
然后,不对做项目做任何额外的变动,只是把项目完整拷贝到新路径。
新路径如下:
E:\Github\AndroidProgramming3eMm
在新路径中添加一个用于测试是否可以成功上传的文件:20220613TestToChangePahtUploadGithub.txt,如下图:
将目录从E:\DownloadFiles\BaiduNetdiskDownload\AndroidStudy\00 PDF\AndroidProgramming3eMm
更改到E:\Github\AndroidProgramming3eMm后(通过粘贴复制的方式更改的,文件内容没有任何变化,.git 文件也没有更新变动,
测试还能否正常上传到Github的AndroidProgramming3eMm库中)
2、做更改路径后的上传Github测试
下面,我们做只是更改项目路径后的上传Github测试
1、进入对应目录
2、添加所有文件
3、提交本地仓库并添加提交记录
4、上传本地仓库到Github远程库 ,git bash上的结果成功
去Github远程库页面刷新看一下, 是否上传成功?
如下图,看到我们的测试上传文件:20220613TestToChangePahtUploadGithub.txt已经成功上传,验证结果成功!
Git Bash下shell操作记录:
HONOR@MosesMin-HonorMagicbook16pro2021 MINGW64 /e/Github
$ cd AndroidProgramming3eMm/
HONOR@MosesMin-HonorMagicbook16pro2021 MINGW64 /e/Github/AndroidProgramming3eMm (master)
$ git add .
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/.gitignore.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/.idea/compiler.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/.idea/copyright/profiles_settings.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/.idea/encodings.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/.idea/gradle.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/.idea/misc.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/.idea/modules.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/.idea/runConfigurations.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/app/.gitignore.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/app/build.gradle.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/app/proguard-rules.pro.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/app/src/androidTest/java/com/bignerdranch/android/geoquiz/ExampleInstrumentedTest.java.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/app/src/main/AndroidManifest.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/app/src/main/java/com/example/mosesmin/geoquiz/QuizActivity.java.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/app/src/main/res/layout/activity_quiz.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/app/src/main/res/values-w820dp/dimens.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/app/src/main/res/values/colors.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/app/src/main/res/values/dimens.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/app/src/main/res/values/strings.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/app/src/main/res/values/styles.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/app/src/test/java/com/bignerdranch/android/geoquiz/ExampleUnitTest.java.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/build.gradle.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/gradle.properties.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/gradle/wrapper/gradle-wrapper.properties.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/gradlew.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/GeoQuiz/settings.gradle.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01_FirstApp/LICENSE.txt.
The file will have its original line endings in your working directory
HONOR@MosesMin-HonorMagicbook16pro2021 MINGW64 /e/Github/AndroidProgramming3eMm (master)
$ git add .
HONOR@MosesMin-HonorMagicbook16pro2021 MINGW64 /e/Github/AndroidProgramming3eMm (master)
$ git commit -m "003 commit by MosesMin,change project path but not change any files content,test isUploadSuccess?"
[master b6d6a1a] 003 commit by MosesMin,change project path but not change any files content,test isUploadSuccess?
2 files changed, 4 insertions(+), 1 deletion(-)
create mode 100644 20220613TestToChangePahtUploadGithub.txt
HONOR@MosesMin-HonorMagicbook16pro2021 MINGW64 /e/Github/AndroidProgramming3eMm (master)
$ git push -u origin master
fatal: unable to access 'https://github.com/mosesmindev/AndroidProgramming3eMm.git/': OpenSSL SSL_read: Connection was reset, errno 10054
HONOR@MosesMin-HonorMagicbook16pro2021 MINGW64 /e/Github/AndroidProgramming3eMm (master)
$ git push -u origin master
Enumerating objects: 26, done.
Counting objects: 100% (26/26), done.
Delta compression using up to 16 threads
Compressing objects: 100% (9/9), done.
Writing objects: 100% (14/14), 1.32 KiB | 1.32 MiB/s, done.
Total 14 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To https://github.com/mosesmindev/AndroidProgramming3eMm.git
de6617c..b6d6a1a master -> master
branch 'master' set up to track 'origin/master'.
HONOR@MosesMin-HonorMagicbook16pro2021 MINGW64 /e/Github/AndroidProgramming3eMm (master)
$