我遵循了Github create tagAPI参考中的说明:
1) create a tag from a sha
2) create a reference for that commit
我两个都做了。引用当然只是一个分支,我可以在我的终端上很好地查看它,也可以在githubweb上很好地查看它。你知道吗
但是,标签不见了,既没有Github web,也没有git checkout标签/标签名
我的代码如下:
import json
import requests
from requests.auth import HTTPBasicAuth
url = 'https://api.github.com/repos/MYORG/MYREPO/git/tags'
params = dict(ref="refs/heads/MyNewTag", sha="SHA")
res = requests.post(url, data=json.dumps(params), auth=HTTPBasicAuth('user', 'token'))
# this works and returns a 201 with its own sha
url = 'https://api.github.com/repos/MYORG/MYREPO/git/refs', params = dict(ref="refs/heads/MyNewBranch", sha="SHA")
res = requests.post(url, data=json.dumps(params), auth=HTTPBasicAuth('user', 'token'))
#this also works and returns a 201
但是正如我所说的,这个标签不在githubweb中,我也不能在本地查看它。我错过了什么?你知道吗
问题出在我创建的ref中。它应该是ref/tags/MYNewTag。其代码为:
现在,您可以在执行git fetch之后在本地repo中签出标记,如下所示:
相关问题 更多 >
编程相关推荐