@wakatakatakataka

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

Android StudioでGitHubと連携したいが連携できない

解決したいこと

Android Studioで作成したアプリをGitHubと連携したいです。

発生している問題・エラー

Failed to create GitHub Repository
Can't create user repository
Can't parse GitHub response

該当するソースコード

ソースコードがここでいいのかはわかりません・・・
plugins {
    id 'com.android.application'
    id 'kotlin-android'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "jp.wings.nikkeibp.battle"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }

    buildFeatures {
        viewBinding = true
    }
}

dependencies {

    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.preference:preference-ktx:1.1.1'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

自分で試したこと

Gitはインストール済みです。
Android Studio上でトークンを使い、GitHubにログインはできています。
VCS → Import into Version Control → Share Project on GitHubと選択し、内容を入力するし、shareすると該当したエラーが出ます。

補足情報(FW/ツールのバージョンなど)
Android Studioはバージョン4.1です。
macのOSはBig Surになります。

0 likes

1Answer

share をするということは、ローカルリポジトリに既に物があるということですよね。

GitHub 側のリモートリポジトリは未作成でしょうか? それとも、すでに作成済の状態ですか?
作成済の場合には、何かすでにファイルが入っている状態でしょうか?(README.mdやライセンスファイル、.gitignoreなど)

もしファイルがある状態だったら、リモートリポジトリを作り直して空っぽの状態でやってみるとか、
リポジトリがない状態から実行してみてはいかがでしょうか?

あるいは、コマンドラインで git push --force を実行するか(少し危険なのであまりお勧めしませんが)

0Like

Your answer might help someone💌