Unity项目上传Github

上传Unity项目到Github

首先添加.gitignore文件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Mm]emoryCaptures/

# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta

# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*

# Autogenerated Jetbrains Rider plugin
[Aa]ssets/Plugins/Editor/JetBrains*

# Visual Studio cache directory
.vs/

# Gradle cache directory
.gradle/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.unitypackage

# Crashlytics generated file
crashlytics-build.properties

1.创建本地项目(常用)

1
git init

2.将你的本地仓库与GitHub连接

本地账号标识

1
2
git config --global user.name “你在GitHub上的用户名”
git config --global user.email “你的邮箱”

查看SSH key文件是否存在:

1
cd ~/.ssh

生成SSH Key 文件为:id_rsa.pub

1
ssh-keygen -t rsa -C “你的邮箱”

复制id_rsa.pub文件中的SSH Key,到Github账号settings设置里的SSH Keys添加进去

关联远程仓库

1
git remote add origin “你的仓库SSH地址/http地址”

3.项目上传至GitHub

拉取GitHub:

1
git pull origin master

提交

1
2
3
git add .
git commit -m "尝试"
git push -u origin master
加载评论
点击刷新